Web Hosting Talk







View Full Version : Xilinus Portal and Prototype Ajax


latheesan
02-15-2009, 07:16 PM
Hi,
I am working on a website that makes use of Xilinus Portal (http://blog.xilinus.com/2007/8/26/prototype-portal-class).
The problem is, I can't use prototype ajax to load contents dynamically into every widget i create. The response text from the ajax load event always says "undefined". There is no javascript error either.
This is what I have so far.
JS Function To Make AJAX Requests
function Ajax_Load (file)
{
var uid = new Date();
new Ajax.Request(file +'.php?uid='+ uid.getTime(),
{
method: 'get',
onSuccess: function(transport){
var response = transport.responseText || "No response from server ...";
return response;
},
onFailure: function(){ alert(file +'.php" does not exists on this server!'); }
});
}
Create Portal and Add Widgets
var portal;
function onOverWidget(portal, widget)
{
widget.getElement().insertBefore($('control_buttons'), widget.getElement().firstChild);
$('control_buttons').show();
}
function onOutWidget(portal, widget)
{
$('control_buttons').hide();
}
function removeWidget(element)
{
var widget = $(element).up(".widget").widget;
if (confirm('Are sure to remove this widget?'))
{
document.body.appendChild($('control_buttons').hide())
portal.remove(widget);
}
}
function onChange() { }
function init()
{
// Create New Portal
portal = new Xilinus.Portal("#main div", {onOverWidget: onOverWidget, onOutWidget: onOutWidget, onChange: onChange});
// Load Contents
var widget_1 = Ajax_Load('widget_1');
// Load Default Widgets
portal.add(new Xilinus.Widget().setTitle("News Widget #1").setContent(widget_1), 0);
// Add controls buttons
portal.addWidgetControls("control_buttons");
}
Event.observe(window, "load", init);
widget_1.php
<?php echo "Hello World!"; ?>
When the site loads, i see the widgets and they are working fine (as in they are dragable and each widget can be closed etc). The problem is, the contents from the .php file is not being loaded via ajax and put into the widget.
Where I am I going wrong? Can someone shed some light on this please. Thank you.

gplhost
02-17-2009, 01:55 AM
If I was you, I would NOT use my own code. There are plenty of Ajax api stuff, like that one:
http://xanjax.org/
Thomas

elvis1
06-28-2009, 10:27 PM
If I was you, I would NOT use my own code. There are plenty of Ajax api stuff, like that one:
http://xanjax.org/
Thomas

are you kidding???? he didnt develop that code ( as he states)..

AND:

From the link you provided :

Most of code done by: Thomas GOIRAND (http://thomas.goirand.fr/), under LGPL (http://www.gnu.org/). Please visit GPLHost hosting VPS services (http://gplhost.com/hosting-vps.html) and DTC GPL control panel home (http://gplhost.com/software-dtc.html) for more info.

sumed to:

404 Error: the requested document does not exist



in every page of the web you provided. my question is: why are you constantly trying to understimate us and trying to sell your products ( quality of your products speaks for themselves here)..

I donīt really get you..

gplhost
06-30-2009, 05:54 AM
What code do you think he didn't write? The guy even helped me to use his library. Where did you see he didn't write it? Sure, he is using the json lib, but this is quite common when doing Ajax.

As for the 404 error, it does only mean that the author is using our web hosting control panel. It doesn't mean that this is my product. Why do you think I'm selling anything here? You are being totally paranoid.

I've just posted a link to a lib that I found quite cool, and a very nice author that helped me to use his code. I'm not underestimating anyone, I'm just giving my experience and I'm trying to help.

Now, the above post is really silly...

Thomas

HivelocityDD
06-30-2009, 09:52 AM
If you are using json make sure they are created as json object instead of standard array objects.