我有这个代码:
$(window).load(function(){
setInterval(function(){
var username=_userdata['username'];
var username=_userdata['username'];
$.get('/notification.forum',function(data){
var b= data.unread;
if(b >= 1){
var c = data.store;
for(var keys in c){
var d = c[keys];
if(d.read === 0){
var e= d.text.type;
var from= d.text.from.name;
var topic = e===7 ? "in the topic "+d.text.post.topic_name.replace(/-/g,' ') : "";
var type= Notify(e);
createNotifcation('http://i.imgur.com/LPVUvcf.png',username + ' you have a new notification!',type + " from "+from+" "+topic);
}
}
}
});
},5000);
});
但我想实时制作。它每 5 秒检查一次,但这会使我的论坛出现错误,例如超出请求限制.. 好吧,这很烦人。我的论坛:www.daily-support.org