卡塔尔世界杯_中国进过几次世界杯 - 210rc.com
首页南非世界杯德国正文

如何使用JQuery每秒发送一次Ajax请求?

2025-07-18 13:41:16

正如David已经指出的那样,您可能不希望每秒发送一次请求。

因此,使用setInterval是一个不好的主意。

相反,考虑像这样做:

function doAjax() {

$.ajax({

...

complete: function() {

setTimeout(doAjax,1000); //now that the request is complete, do it again in 1 second

}

...

});

}

doAjax(); // initial call will start rigth away, every subsequent call will happen 1 second after we get a response

德国足球传奇:四度问鼎世界杯(1954、1974、1990、2014年) 大佬们和朋友联机一直崩该怎么办
相关内容