Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Ajax 404 Handling

Tags:

jquery

Im trying to access a 404 event which I can see coming back as 404 with firebug but the error function is not kicking in, With my below code I always get Error: success ?.

ie.

$.ajax({     type: 'get',     url: 'url: 'https://admin.instantservice.com/resources/smartbutton/5702/10945/available.gif?' + Math.floor(Math.random()*10001),     success: function(data, textStatus, XMLHttpRequest){         console.log('Error: ' + textStatus);     },     error:function (xhr, ajaxOptions, thrownError){         alert(xhr.status);         alert(xhr.statusText);         alert(xhr.responseText);     } }); 

Again I know 1000% that im getting 404 Not Found in firebug it never triggers the error.

Am I missing something ?

like image 823
Lee Avatar asked Nov 25 '10 22:11

Lee


1 Answers

Cross Site requests, JSONP, wont trigger the error calls. Just had the same problem myself: http://forum.jquery.com/topic/jquery-ajax-with-datatype-jsonp-will-not-use-error-callback-if-request-fails

like image 148
firecall Avatar answered Sep 22 '22 03:09

firecall