<h1>Live resultater</h1>
<br>
<table id ="table">
    <tr>
        <th>Some shit</th>
        <th>Some shit</th>
    </tr>
</table>

<script>
var hash = 0;

function main()
{
    setInterval(function() {
        updateTable() 
    }, 1000);

    updateTable();
}

async function updateTable()
{
    let response = await fetch("sync.php?h=" + hash);

    if (response.status === 204)
    {
        return;
    }

    let json = await response.json();

    hash = json.hash;

    let data = json.data;

}

document.addEventListener('DOMContentLoaded', function() {
    main();
});
</script>