当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - How to refresh $.getJSON?

问题描述:

How can I make this code update every 1 minute?

$.getJSON('/stats/rest/service.php/network/status', function(result) {

$("#currentusers").text(result.users.val);

});

网友答案:
setInterval(function () {
  $.getJSON('/stats/rest/service.php/network/status', function(result) {
      $("#currentusers").text(result.users.val);
  });
}, (1000*60)*1 ); // change '1' to however many minutes
分享给朋友:
您可能感兴趣的文章:
随机阅读: