开发者

How can I refresh JSON data with JQuery?

开发者 https://www.devze.com 2023-03-09 12:34 出处:网络
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.

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

0

精彩评论

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