I am creating a really simple mobile app for our local track club. The app seems to be working fine when I test it on my localhost but when I change the links to point to my remote server and then package the app nothing seems to render. I am hoping that this is a really easy fix. Here is a page that I would like to populate using a JSON object into a HTML frame using Javascript.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>United Track Club</title>
<link href="jquery-mobile/jquery.mobile-1.0.1.min.css" rel="stylesheet" type="text/css"/>
<!-- This reference to phonegap.js will allow for code hints as long as the current site has been configured as a mobile application. -->
<script src="jquery-mobile/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="/phonegap.js" type="text/javascript"></script>
<script src="jquery-mobile/jquery.mobile-1.0.1.min.js" type="text/javascript"></script>
<!--a name="viewport"content="width=device-width, initial-scale=1"> -->
</head>
<body>
<div data-role="page" id="runnerListPage">
<div data-role="header">
<h1>Runners2</h1></div>
<div data-role="content">
<ul id="runnerList" data-role="listview" data-filter="true">
</ul>
</div>
<div data-role="footer" data-position="fixed">
<div data-role="navbar">
<ul>
<li><a href="index.html" data-icon="home">Home</a></li>
<li><a href="#searchListPage" data-icon="search">Search</a></li>
<li><a href="#scheduleListPage" data-icon="grid">Schedule</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
Here is the JS that I created to populate the above code.
$.getJSON('http://unitedtrack.org/Mobile/TF/getrunnerlist.php', function(data){
var object = data.items,
runnerCount = object.length,
target = document.getElementById('runnerList'),
i;
if (runnerCount>0){
for (i =0 ; i< runnerCount; i=i+1){
var unitrun=object[i],
EventDt = unitrun.First_Nm,
MeetNm = unitrun.Last_Nm;
target.innerHTML +='<li><a href="#">'+ EventDt +', ' +MeetNm +' </a></li>';
}
}
else {
alert('there are no runners');
}
});
target.addEventListener("click",data,false);
Thank you in advance for your help.
$.getJSON()also come from "unitedtrack.org" or is it on your local machine (or somewhere else)? If so, that's your problem.