I am accessing a cross-domain web service using jQuery a.ajax call from an html page. Although I see jsonp data using firebug, I cannot load it into a variable or even display it (for debugging purposes). Attempts to retrieve data using jsonpCallback, successful and complete functions always result in 'undefined' / null data.
Ultimately, I need to save the data in variables. Any help would be greatly appreciated!
$.ajax({
data: {
User: UserValue,
GUID: GUIDValue
},
cache: false,
dataType: "jsonp",
type: "GET",
crossDomain: true,
jsonp: false,
jsonpCallback: function (saveData) {
if (saveData == null) {
alert("DATA IS UNDEFINED!");
}
alert("Success is " + saveData);
},
url: "http://localhost/NotifMOD/NotifService.svc/GetAllMessages?callback=success?",
async: false,
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus, errorThrown);
},
complete: function (a, b) {
alert(a);
alert(b);
}
});
source
share