Jquery ajax request error callback is called instead of success even after response recieved from server
- by Muhammad Tahir Butt
I am using jquery ajax funtion to get some content from my webservice. Response from the server is received but every time error callback is called instead of success callback.
And this error is returned in xhr.error:
function (){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this}
Here is the screenshot of response from server:
and here is the code i am using to make the request:
function abcdef()
{
$.ajax({
url: "http://192.168.61.129:8000/get-yt-access-token/",
type: "GET",
contentType:"application/json",
error: function(xhr, textStatus, errorThrown){
alert("its error! " + xhr.error);
},
success: function(data){
alert(data);
}
});
}