This commit is contained in:
William 2022-03-30 12:50:21 +00:00
parent 72a246f6ac
commit ab1810979b

View File

@ -8,24 +8,35 @@
</table> </table>
<script> <script>
hash = 0; var hash = 0;
async function doTheThang()
function main()
{ {
response = await fetch("sync.php?h=" + hash); setInterval(function() {
updateTable()
}, 1000);
updateTable();
}
async function updateTable()
{
let response = await fetch("sync.php?h=" + hash);
if (response.status === 204) if (response.status === 204)
{ {
return; return;
} }
json = await response.json(); let json = await response.json();
hash = json.hash; hash = json.hash;
data = json.data;
document.getElementById("table").innerHTML = json.data; let data = json.data;
} }
setInterval(function() { doTheThang() }, 1000) document.addEventListener('DOMContentLoaded', function() {
doTheThang(); main();
});
</script> </script>