开发者

Will Long AJAX requests in SetInterval Terminate if longer than the interval

Let's say I have a 开发者_C百科line of code that looks like this:

setInterval(ajaxFunction,3000);

where ajaxFunction is a function that calls a PHP script and returns something. If this request happens to take longer than 3 seconds, what happens? will It terminate the current request and start over, or will it start a 2nd request and have both running at once? (or some other behavior I haven't thought of)


They will overlap. Rather than setInterval, you could use setTimeout and set it within your oncomplete handler within the ajaxFunction.


They will overlap. Your second ajax call will begin before the first one completes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜