Ajax实现定时刷新

js定时刷新

function getClientsStatus() {
  var refresh_client = function() {
    $.ajax({
      type: "POST",
      url: "../get_clients_status/",
      data: {
        "csrfmiddlewaretoken": csrfToken,
        "utils_id": $("#utils").val()
      },
      success: function (data) {
        $("#service_status").text(data.status);
      },
    });
  };
  refresh_client();
  setInterval(refresh_client, 60000);    60秒定时刷新一次
}
getClientsStatus();

posted @ 2021-08-04 14:56  TianShu  Views(647)  Comments(0Edit  收藏  举报