diff options
Diffstat (limited to 'web/js')
-rw-r--r-- | web/js/realtime.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/web/js/realtime.js b/web/js/realtime.js new file mode 100644 index 0000000..4526e5e --- /dev/null +++ b/web/js/realtime.js @@ -0,0 +1,27 @@ +function update() { + + var data; + + fetch('/latest') + .then(function(resp) { + return resp.json(); + }) + .then(function(response) { + data = response; + var table = document.querySelector('#latest').children; + table[0].textContent = data.TimeStamp; + table[1].textContent = data.Co; + table[2].textContent = data.No; + table[3].textContent = data.So; + + }) + .catch(function(error) { + console.log(error); + }); + + + + +} + +setInterval(update, 60000); |