22 lines
666 B
JavaScript
22 lines
666 B
JavaScript
function update() {
|
|
fetch('https://time.qtechofficial.com/kiosk/data')
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
let tbody = document.getElementById('tbody');
|
|
tbody.innerHTML = "";
|
|
console.log(data);
|
|
data.forEach(person => {
|
|
let tr = document.createElement('tr');
|
|
tbody.appendChild(tr);
|
|
let td_name = document.createElement('td');
|
|
td_name.innerHTML = person.first_name + " " + person.last_name;
|
|
tr.appendChild(td_name);
|
|
let td_time_here = document.createElement('td');
|
|
td_time_here.textContent = person.time_here;
|
|
tr.appendChild(td_time_here);
|
|
})
|
|
})
|
|
.catch(error => console.error(error))
|
|
}
|
|
|
|
setInterval(update, 1000);
|