I'm very new to phonegap. I installed the phonegap2.1.0
in xcode4.5
. Now phonegap is working fine. But how can I call a webservice and get a json response for phonegap? My code is below, but it isn't working. Can anybody help me?
$(document).ready(function () {
$.ajax({
alert("alert");
url: "http://localhost:55022/WebSite1/sample.asmx/returnEmployees",
data: null,
crossDomain: true,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg, textStatus, jqXHR){
alert(textStatus);
//var theRealData = msg.d;
/*
$.each(theRealData.employees, function (index, item) {
// at this point, item is an array, since theRealData.employees is an array of arrays
var col1 = item[0];
var col2 = item[1];
alert(col1);
}); */
},error:function(jqXHR, textStatus, errorThrown){
console.log(textStatus +"------" +errorThrown + jqXHR );
// navigator.notification.alert('Server Error');
}
});
});