Cercaorario con problemi linea

This commit is contained in:
Leocraft1
2025-11-04 18:14:49 +01:00
parent 59590a394c
commit e78bc0bdda
6 changed files with 278 additions and 2 deletions

View File

@@ -0,0 +1,36 @@
const params = new URLSearchParams(window.location.search);
const num = params.get('routenum');
const newsContainer = document.getElementById('notizie-container');
const lineaSpan = document.getElementById('linea-span');
//Urls
const url = "https://setaapi.serverissimo.freeddns.org/routeproblems/"+num;
//Display numero linea
lineaSpan.textContent=num;
//Spawn product card
fetch(url)
.then(response => {
if (!response.ok) throw new Error("Errore nel caricamento dei dati.");
return response.json();
})
.then(data => {
newsContainer.innerHTML='';
data.problems.forEach(element => {
var div = document.createElement("div");
div.setAttribute("class","news-card");
var p = document.createElement('p');
var h3 = document.createElement('h3');
var a = document.createElement('a');
const link = "/seta_modena/menu/notizia.html?link="+element.link;
a.setAttribute("href",link);
a.setAttribute("class","bianco");
p.innerHTML=element.date;
h3.innerHTML=element.title;
a.appendChild(p);
a.appendChild(h3);
div.appendChild(a);
newsContainer.appendChild(div);
});
})