Reputation: 119
I have set up a polling script which basically checks the notification_queue if any new notifications are available. If they are it will display them and delete the notification from the queue.
I'm using firebug and when I reload the page the previous poll stays open and a new one is created.
function poll(){
$.ajax({
url: "test.php",
dataType: "json",
complete: poll,
timeout: 30000,
success: function(data){
$.gritter.add({
title: 'This is a regular notice!',
text: data.message,
image: 'http://a0.twimg.com/profile_images/59268975/jquery_avatar_bigger.png',
sticky: false,
time: ''
});
},
error: function(){
alert("OMG ERROR");
}
});
};
poll();
Upvotes: 0
Views: 269
Reputation: 1744
I am pretty sure the reason is that you pass poll as the complete function, effectively creating a non-terminating or cascading recursion (don't know if that is the proper term from programming 101 ...)
Upvotes: 2