I was trying to invoke a webservice from phonegap android app using jQuery .ajax
But im getting the response as null .
$.ajax({
type: “GET”,
data: ‘{continent: “‘ + $(‘#txtContinent’).val() + ‘”}’,
url: “http://localhost:60931/Service1.asmx/GetCountries”,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(response) {
alert(response);
},
failure: function(msg) {
$('#result').empty().append(msg);
}
});
can anyone help me in invoking a web service from phonegap app using jQuery .ajax
it will not work until you implement JSONP for your Webservice.
JSONP lets remote calles happen, because cross-site XHR calls are not permitted by default.
A nice implementation of JSONP for ASP.Net Webservices:
http://bloggingabout.net/blogs/adelkhalil/archive/2009/08/14/cross-domain-jsonp-with-jquery-call-step-by-step-guide.aspx