There is a function:
(function poll() { setTimeout(function() { $.ajax({ type: "GET", url: "/api/system", processData: true, dataType: 'text', cache: false, success: function (data, textStatus, request) { var system = jQuery.parseJSON(data); $(".uptime").var(system.uptime); $(".system-uptime").var(system.systemUptime); } }); }, 1000); })(); it receives data from JSON, processes and replaces the value in ".uptime" and ".system-uptime" . According to the idea, this happens every second, a value of 1000 (ms). What I get: I receive data, it appears on the web page, but it does not update every second, although this function is called in the console. How to solve this problem? Is it possible to get around all this in the similarity:
(function poll() { setTimeout(function() { $.ajax({ type: "GET", url: "/api/system", processData: true, dataType: 'text', cache: false, success: function (data, textStatus, request) { var system = jQuery.parseJSON(data); $("input[id='uptime']").val(system.uptime); $("input[id='sysUptime']").val(system.systemUptime); } }); }, 1000); })(); however, not with input.
.valinstead of.val. Isn't that the problem? - Dmitriy Simushev