I am facing an issue with my code. It works perfectly in Chrome, but when I try to run it on Android, the alert("test") function is never called. I created an apk using PhoneGap and am also using jQuery Mobile. Can anyone help me figure out what I am missing? Is there another way to create a dynamic listview from the data received in a json response?
Thank you for your assistance.
$( document ).bind( "mobileinit", function(){
$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
$.mobile.loadingMessageTextVisible = true;
$.mobile.showPageLoadingMsg();
})
$( document ).ready(function (){
$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
e.preventDefault();
alert("test");//-----------------------------------------------
$.ajax({
crossDomain: true,
type: 'GET',
url: 'http://ip/services/rest/contact/list',
callback: 'jsonpCallback',
jsonpCallback: 'jsonpCallback',
jsonp: '_jsonp',
contentType: 'application/json',
dataType: 'jsonp json',
timeout : 10000,
success: function(data){
var html ='';
alert("data.firstName");
$.each(data, function(key, data) {
html += '<li><a class=contact href="#" ><h1>' + data.label + '</h1><p>'+ data.customerName + '</p><p>' + data.phone + ', ' + data.email + '</p><p>' + data.id + '</p></a></li>';
$('#ul_id').append($(html));
html='';
});
$('#ul_id').trigger('create');
$('#ul_id').listview('refresh');
},
error: function (xhr, ajaxOptions, thrownError){
alert("Status: " + xhr.status + ", Ajax option: " + ajaxOptions + ", Thrown error: " + thrownError);
//location.reload();
},
});
;
});