8
I have the following code and I am retrieving JSON from a site using JSONP. I want to handle error code like 404 bad request. Following is not working for me.
$.getJSON('https://xyz.com/search?jsonp-callback=?', function(data) {
alert("success");
})
.success(function() { alert("success 2"); })
.error(function() { alert("error occurred "); })
.complete(function() { alert("Done"); });
Success and complete methods are working but error method is not working.