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);
精彩评论