AJAX debug

Nice little JS snippet for debuggin JQuery AJAX calls..  For example JQuery $.POST() will fail silently, this will show what went wrong!



 


//AJAX error output help


$.ajaxSetup({


error:function(x,e){


console.log(x.responseText);


alert('AJAX error, check console!');


$("#message_post").empty().append("Error With You AJAX!");


}


});


 

Bookmark and Share
  1. Phillip Senn

    #1 by Phillip Senn - November 24, 2011 at 7:49 AM

    I think the new hotness is to use .done and .fail.
    Also, using a naked console.log will lock up in IE.
    You have to wrap it in if (console.log) {}
  2. erik

    #2 by erik - January 26, 2012 at 11:58 AM

    ya saw that... and just another reason not to use IE!
(will not be published)