make stats GET

This commit is contained in:
Jethro Grassie 2019-03-07 17:17:11 -05:00
parent 6a0c5475a1
commit b8c5bfdfc7
No known key found for this signature in database
GPG Key ID: DE8ED755616565BB
1 changed files with 5 additions and 5 deletions

View File

@ -65,7 +65,6 @@
} }
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open("POST", "/stats");
xhr.onload = function() xhr.onload = function()
{ {
var stats = JSON.parse(xhr.responseText); var stats = JSON.parse(xhr.responseText);
@ -94,7 +93,6 @@
}; };
window.onload = function() window.onload = function()
{ {
xhr.send(null);
if (/wa=[0-9a-fA-F]+/.test(document.cookie)) if (/wa=[0-9a-fA-F]+/.test(document.cookie))
{ {
var wh = document.querySelectorAll(".wallet"); var wh = document.querySelectorAll(".wallet");
@ -105,11 +103,13 @@
var c = document.cookie.split("="); var c = document.cookie.split("=");
wa.value = c[1]; wa.value = c[1];
} }
setInterval(function() var get_stats = function()
{ {
xhr.open("POST", "/stats"); xhr.open("GET", "/stats");
xhr.send(null); xhr.send(null);
}, 30000); };
setInterval(get_stats, 30000);
get_stats();
}; };
</script> </script>
</body> </body>