In this repo i store all my websites, each in a different branch
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.7 KiB

// Trein Tijden opvragen en weergeven
$.ajax({
url: 'https://api.vertrektijd.info/ns/_departures?station=dn',
type: 'get',
headers: {
"Accept-Version": '1.3.0',
"X-Vertrektijd-Client-Api-Key": 'cymk3fzZHYTiAl974wPMgqrGvDuU0p'
},
dataType: 'json',
success: function(data) {
$('#vertrek_trein').empty();
$.each(data, function(i,tijd){
content = '<tr>';
content += '<td>' + Object.values(tijd.VertrekSpoor)[0] + '</td>';
content += '<td>' + tijd.EindBestemming + '</td>';
var str = tijd.VertrekTijd;
var res = str.slice(11, 16);
content += '<td>' + res + '</td>';
content += '</tr>';
$(content).appendTo("#vertrek_trein");
return i<2;
});
}
});
// Bus Tijden opvragen en weergeven
$.ajax({
url: 'https://api.vertrektijd.info/departures/_stopcode/65520012,65520210,65520011/',
type: 'get',
headers: {
"Accept-Version": '1.3.0',
"X-Vertrektijd-Client-Api-Key": 'cymk3fzZHYTiAl974wPMgqrGvDuU0p'
},
dataType: 'json',
success: function(data2) {
$('#vertrek_bus').empty();
$.each(data2.BTMF, function(b,tijd2){
$.each(tijd2.Departures, function(i, data3){
if(i<1){
content = '<tr>';
content += '<td>' + data3.LineNumber + '</td>';
content += '<td>' + data3.Destination + '</td>';
var str = data3.PlannedDeparture;
var res = str.slice(11, 16);
content += '<td>' + res + '</td>';
content += '</tr>';
$(content).appendTo("#vertrek_bus");
}
});
});
}
});