Im trying to build a mobile application from my webapp with PhoneGap. Everything works fine on desktop browser, but when I move files to PhoneGap the getJSON method doesn't seem to work. What could be the reason?
This is the code I use:
$('#employeeListPage').bind('pageinit', function(event) {
getEmployeeList();
});
setInterval ( "getEmployeeList()", 10000 );
var vanhadata = "";
function getEmployeeList() {
$.getJSON(serviceURL + 'getemployees.php?autonumero=' + autonumero, function(data) {
if(JSON.stringify(data) != JSON.stringify(vanhadata)){
$('#employeeList li').remove();
employees = data.key;
$.each(employees, function(index, employee) {
$('#employeeList').append('<li><a href="keikka.html?id=' + employee.IND + '">' +
'<h4>' + employee.OSO + '</h4>' +
'<img src="pics/' + employee.TILA + '.png"/>' +
'<p>' + employee.AIKA + '</p>' +'</a></li>');
});
$('#employeeList').listview('refresh');
if(vanhadata != "")
alert("Uusia keikkoja!");
vanhadata = data;
}
});
}
Because it is cross-domain request I have also tried to use callback=? but that doesn't work either. How can i fix this?