Upload files to "js"
This commit is contained in:
parent
e6183a48e2
commit
c3c46a7209
|
@ -5,9 +5,10 @@ const selectedOption = params.get('selectedOption');
|
||||||
console.log(palina, targetID, selectedOption);
|
console.log(palina, targetID, selectedOption);
|
||||||
|
|
||||||
// Esempio URL backend che ritorna JSON { linea, destinazione, veicolo, soppressa }
|
// Esempio URL backend che ritorna JSON { linea, destinazione, veicolo, soppressa }
|
||||||
const urlBackend = `http://URL-API/?param=${targetID}¶m2=${selectedOption}&palina=${palina}`;
|
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(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const container = document.getElementById('tabella-container');
|
const container = document.getElementById('tabella-container');
|
||||||
|
@ -55,4 +56,9 @@ fetch(urlBackend)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error('Errore nel caricamento dati:', err);
|
console.error('Errore nel caricamento dati:', err);
|
||||||
document.getElementById('tabella-container').textContent = 'Errore nel caricamento dati.';
|
document.getElementById('tabella-container').textContent = 'Errore nel caricamento dati.';
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
caricadati();
|
||||||
|
|
||||||
|
setInterval(caricadati, 60000);
|
Loading…
Reference in New Issue