I have been trying to figure out why my code below fails when I refresh the browser. For example the code works fine when first accessing the page, however as soon as I refresh, the list goes blank for a couple of seconds. Then after those seconds pass I'm able to see the content again by refreshing the screen. I performed the "Inspect Element" option and it showed me the following error
"Uncaught ReferenceError: jQuery11110765894684009254_1423584082469 is not defined"
What does this mean? If this can be fixed is there a way to make the screen refresh automatically after 20 or 30 seconds? Before I forget, the API key that I'm using is a temporary key found here.
https://developer.wmata.com/Products
Thanks in advance.
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<div data-role="page" id="page1">
<div data-role="header" data-position="fixed" data-tap-toggle="false">
<h1>My page</h1>
</div>
<div role="main">
<ul data-role="listview" data-inset="true" id="test1"></ul>
</div>
<div data-role="footer" data-position="fixed" data-tap-toggle="false">
<h1>My page footer</h1>
</div>
</div>
<script>
$.ajax({
url: 'https://api.wmata.com/StationPrediction.svc/json/GetPrediction/B01,F01?api_key=kfgpmgvfgacx98de9q3xazww',
dataType: 'jsonp',
}).success(function (data){
for(var i =0; i < data.Trains.length; i++)
{
$("#test1").append($("<li><a href='#'>Line: "+data.Trains[i].Line+" Cars:"+data.Trains[i].Car+" Destination:"+data.Trains[i].DestinationName+" Min: "+data.Trains[i].Min+"</a></li>"));
}
$("#test1").listview("refresh");
});
</script>