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:
url: "Service1.asmx/GetCountries"
在应用程序中可以访问此服务URL吗?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.