From 4c74b2f557c96513879f0e1b1575e3fe08190f30 Mon Sep 17 00:00:00 2001 From: Curry141 <135717077+Daniongithub@users.noreply.github.com> Date: Fri, 20 Jun 2025 19:30:46 +0200 Subject: [PATCH] added refresh --- start_menu/servizi/start-fermatebus/js/fermata.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/start_menu/servizi/start-fermatebus/js/fermata.js b/start_menu/servizi/start-fermatebus/js/fermata.js index 08baaff..4de5d05 100644 --- a/start_menu/servizi/start-fermatebus/js/fermata.js +++ b/start_menu/servizi/start-fermatebus/js/fermata.js @@ -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}¶m2=${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.'; - }); \ No newline at end of file + }); +} + +caricadati(); + +setInterval(caricaDati, 60000); \ No newline at end of file