Difference between revisions of "Widget:Ctarailtimes"

From Transit.Wiki
m
m
 
(One intermediate revision by the same user not shown)
Line 34: Line 34:
 
var alltimes = "<div style='display:table;width:100%;'>";
 
var alltimes = "<div style='display:table;width:100%;'>";
 
var times = [];
 
var times = [];
 +
if (typeof data3 !== "undefined") {
 
for (var g = 0; g < data3.length; g++) {
 
for (var g = 0; g < data3.length; g++) {
 
   lines1.push(data3[g].rt);
 
   lines1.push(data3[g].rt);
Line 90: Line 91:
 
alltimes = alltimes.slice(0, -5);
 
alltimes = alltimes.slice(0, -5);
 
$("#output<!--{$stopid}-->").append(alltimes);
 
$("#output<!--{$stopid}-->").append(alltimes);
 
+
}
if (Object.is(data3, null)) {
+
else {
 
$("#output<!--{$stopid}-->").append("<p>No predictions available.</p>");
 
$("#output<!--{$stopid}-->").append("<p>No predictions available.</p>");
 
}
 
}

Latest revision as of 02:20, 18 May 2024