added refresh

This commit is contained in:
2025-06-20 19:30:46 +02:00
committed by GitHub
parent f9d0ddc88a
commit 4c74b2f557

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);