【发布时间】:2012-03-12 23:58:02
【问题描述】:
我已经设置了一个轮询脚本,它基本上检查 notification_queue 是否有任何新的通知可用。如果是,它将显示它们并从队列中删除通知。
我正在使用 firebug,当我重新加载页面时,之前的投票保持打开状态并创建了一个新的。
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();
【问题讨论】:
标签: ajax long-polling