function update() { fetch('http://localhost:9050/api/ais') .then(function (response) { return response.json(); }) .then(function (data) { updateData(data); }) .catch(function (err) { console.log('error: ' + err); }); function updateData(data) { var table = document.getElementById("aisTable"); const table = document.getElementById('Table'); let numItems = 1; numItems++; const row = document.createElement('tr'); row.innerHTML = `