开发者

How to call .post() in a given time interval?

I would like to update some <div> in a given time interval. Let say every 3 seconds call mypost() fun开发者_开发问答ction.

How to do that in jquery?

Thanks Arman.


There's nothing in jquery that allows you to do this because there's the native javascript window.setInterval function:

window.setInterval(function() {
    // this will be invoked on every 5s
    $.post(...);
}, 5000);

If you want to invoke it only once:

window.setTimeout(function() {
    // this will be invoked after 5s only once
    $.post(...);
}, 5000);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜