I'm trying to make long poll ajax calls, back to back. The problem with the current way I'm doing it is that I make each successive call from the callback function of the previous call. Is this a problem? Firebug doesn't show any of my ajax calls as completed, even thought the data is returned and the callback is executed. The recursive structure seems inefficient. Any ideas?
window.addEvent('domready', function()
{
server = new Request({
url: "chat.php",
method: 'get',
link: 'ignore',
onSuccess: callback,
});
request = server.send();
}
function callback(data)
{
console.log(data);
var data = JSON.decode(data);
messId = data.max;
for(var i = 0; i < data.messages.length; i++)
{
print("", data.messages[i].text);
}
var sendString = "messId="+messId;
request = server.send(sendString);
}