How can I refresh JSON data with JQuery?
Forgive me for asking what may appear a simple question, but I cannot seem to find an answer that I understand. I am relatively new to JavaScript and JQuery.
My problem is that I am retrieving JSON data from another server, however, this information changes fairly rapidly (It monitors the status and current latency of a server). I then parse the information in this feed to JavaScript variabl开发者_如何学Pythones and display it on my page.
How can I update this data within certain time intervals? for example, every minute, rather than it being updated when the user refreshes the page?
Thanks very much!
Jacob
You can use
setInterval(function(){
// get new json result from server by Ajax here
}, interval_time);
You can use setTimeout
: http://forum.jquery.com/topic/javascript-sleep-wait-and-use-of-settimeout
精彩评论