I've a function that calls jquery ajax to hit a restful service developed in C#. the code is as follow
function refreshUsage(macAdd)
{
alert(macAdd);
ajax = $.ajax({
type: "GET",
data: {'mac': '1'},
dataType: "jsonp",
jsonp:false,
async:false,
jsonpCallback:'blah',
crossDomain: true,
cache: false,
contentType: "application/json; charset=utf-8",
url: "http://localhost:20809/api/keyGen",
ajaxSuccess: function(data)
{
data = JSON.parse(data);
console.log("data _" +data);
},
error: function(xhr, status, error) {
if (status === 'parsererror') {
console.log("resptext__" + xhr.responseText)
}
console.log("status _" +status);
console.log("error _" +error);
},
complete: function(response)
{
console.log("response _" +response);
},
});
}
var blah = function (data) {
alert(data);
//do some stuff
}
when i hit this given url, it's sending response in browser window. but when im trying to get the response text in ajax function it's coming undefined even though success code is 200 and success text is success. I'm getting following errors and no response:
resptext__undefined
status _parsererror
error _Error: blah was not called