如何刷新$ .getJSON?

时间:2016-04-15 19:45:50

标签: javascript jquery

如何每1分钟更新一次代码?

$.getJSON('/stats/rest/service.php/network/status', function(result) {
    $("#currentusers").text(result.users.val);
});

1 个答案:

答案 0 :(得分:0)

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