Skip to content

Commit

Permalink
Update StopVar.html
Browse files Browse the repository at this point in the history
  • Loading branch information
delijn821 authored Oct 15, 2024
1 parent 601dace commit cf74fdd
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions StopVar.html
Original file line number Diff line number Diff line change
Expand Up @@ -412,33 +412,33 @@ <h3 style="text-align: center;">©2024 Yoni Dardenne</h3>
rows.forEach(row => tbody.appendChild(row));
}

function getHalteIdFromUrl() {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get('halteId');
}

function fetchDepartureTimes() {
const halteId = getHalteIdFromUrl();
if (halteId) {
// API-aanroep met de opgehaalde halte-ID
fetch(`https://api.delijn.be/DLKernOpenData/api/v1/haltes/3/${halteId}/real-time?maxAantalDoorkomsten=15`, {
method: 'GET',
headers: {
'Cache-Control': 'no-cache',
'Ocp-Apim-Subscription-Key': 'ee23ac060f8a4038ad6d69358d85a1b0',
}
})
.then(response => response.json())
.then(data => {
// Update de pagina met de opgehaalde gegevens
})
.catch(error => console.error('Error fetching departure times:', error));
} else {
alert('Geen halte-ID gevonden in de URL.');
function getHalteIdFromUrl() {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get('halteId');
}

function fetchDepartureTimes() {
const halteId = getHalteIdFromUrl();
if (halteId) {
// API-aanroep met de opgehaalde halte-ID
fetch(`https://api.delijn.be/DLKernOpenData/api/v1/haltes/3/${halteId}/real-time?maxAantalDoorkomsten=15`, {
method: 'GET',
headers: {
'Cache-Control': 'no-cache',
'Ocp-Apim-Subscription-Key': 'ee23ac060f8a4038ad6d69358d85a1b0',
}
})
.then(response => response.json())
.then(data => {
// Update de pagina met de opgehaalde gegevens
})
.catch(error => console.error('Error fetching departure times:', error));
} else {
alert('Geen halte-ID gevonden in de URL.');
}
}
}

document.addEventListener('DOMContentLoaded', fetchDepartureTimes);
document.addEventListener('DOMContentLoaded', fetchDepartureTimes);


</script>
Expand Down

0 comments on commit cf74fdd

Please sign in to comment.