Hi,
I am using default WebAPI
asp.net project which returns string value when call GET method. When I invoke this method from Phone Gap (Visual Studio Windows Phone Emulator), it always returns method not found error for jsonp. Here is my code
$(document).on('pageinit', '#home', function(){
$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
$(document).on('click', '#search', function(){
$.ajax({
method: "get",
url: url,
contentType: "application/json; charset=utf-8",
dataType: "jsonp",
async:false,
crossDomain: true,
cache: false,
jsonp:'jsonpCallback',
jsonpCallback:'infoData',
success: function (result) {
alert('success');
},
error: function(xhr,textStatus,errorThrown) {
alert(xhr.responseText);
alert(textStatus);
alert(errorThrown);
}
});
});
});
function infoData(jsonObj) {
alert(JSON.stringify(jsonObj)); // print the raw JSON object
alert(jsonObj.validJsonDocument); // access the property in your JSON object.
}