[jQuery] long polling with jQuery
Hello,
I would like to create a chat application that dosen't need a
setTimeout(), so I'm starting an ajax request that give a response if
there is something to display :
function checkChat(){
new jQuery.ajax({
'url' : './chat/check.php',
'cache' : false,
'success' : function(messages){
if( messages.length ){
$("#empty_chat").append(messages);
}
checkChat();
}
});
}
That's working very well exept two things :
- I'm implementing the chat in a page that have an ajax navigation
(using the plugin history) and others ajax requests (updating boxes
etc..). The problem is that all thoses ajax request are queued until
checkchat give a response.
- I see an working icon (as the ajax request is started).
So I think the question is how to made this request in background/
invisible.
Regards,
Adrien