Wednesday, June 5, 2024
 Popular · Latest · Hot · Upcoming
57
rated 0 times [  61] [ 4]  / answers: 1 / hits: 21161  / 11 Years ago, thu, august 1, 2013, 12:00:00

i like to catch any ajax 401 Unauthorised exception, but do no like to change all my ajax queries. Is there a way to change it for any $.ajax call like (overwrite any error handler) ?


More From » jquery

 Answers
7

you can use the global ajax event handlers .ajaxError()



$( document ).ajaxError(function( event, jqxhr, settings, exception ) {
    if ( jqxhr.status== 401 ) {
        $( div.log ).text( Triggered ajaxError handler. );
    }
});

[#76599] Wednesday, July 31, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
terrencegreysons

Total Points: 674
Total Questions: 102
Total Answers: 105

Location: New Caledonia
Member since Thu, Mar 23, 2023
1 Year ago
;