added refresh

This commit is contained in:
Curry141 2025-06-20 19:30:46 +02:00 committed by GitHub
parent f9d0ddc88a
commit 4c74b2f557
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -7,7 +7,8 @@ console.log(palina, targetID, selectedOption);
// Esempio URL backend che ritorna JSON { linea, destinazione, veicolo, soppressa }
const urlBackend = `https://api.vichingo455.freeddns.org/start-fermatebus.json/?param=${targetID}&param2=${selectedOption}&palina=${palina}`;
fetch(urlBackend)
function caricadati(){
fetch(urlBackend)
.then(res => res.json())
.then(data => {
const container = document.getElementById('tabella-container');
@ -55,4 +56,9 @@ fetch(urlBackend)
.catch(err => {
console.error('Errore nel caricamento dati:', err);
document.getElementById('tabella-container').textContent = 'Errore nel caricamento dati.';
});
});
}
caricadati();
setInterval(caricaDati, 60000);