diff options
author | marwolaethblack <a.unal677@gmail.com> | 2017-11-24 10:48:31 +0100 |
---|---|---|
committer | marwolaethblack <a.unal677@gmail.com> | 2017-11-24 10:48:31 +0100 |
commit | 1e0b1fa7ac2ad0ae07591aca296e3ef33839ef5e (patch) | |
tree | 417957cd569b27919468d46ea6e22009208ef1b5 /web | |
parent | 8a476ef960d6cb20a580334f1e95f11abd069a07 (diff) |
add real time data every 60sec
Diffstat (limited to 'web')
-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); |