I am trying to make a web service call using JSONP. When I called the service using JSON it worked fine. Here is the code for JSON:
$.ajax({
type:defaultOpt.type,
contentType: "application/json; charset=utf-8",
dataType: defaultOpt.dataType,
url: defaultOpt.url,
data: defaultOpt.data,
success: defaultOpt.successCallback,
error: defaultOpt.errorCallback,
async: defaultOpt.asyn
});
However when I call the same service using JSONP, I don't get anything in the response. Here is the code for the call using JSONP:
$.ajax({
dataType: 'jsonp',
data: defaultOpt.data,
url: defaultOpt.url,
success: function (data) {
alert('Success');
},
error: function (data) {
alert("Error");
}
});
This is the stringified response that I get when I use JSONP.
{"readyState":4,"status":200,"statusText":"success"}
It shows success but I don't get the response data from web service.