0

I have a many Ajax request in my project and have a global Ajax Error Handler.

$( document ).ajaxError( function( event, jqxhr, settings) {

    if (// some condition) {
        // resend current Ajax Request
    }

});

How can I detect in which Ajax Request I catch an error and resend it ? I try to find "resend" solutions but do not find for global case. I appreciate any help :)

Odin Thunder
  • 3,284
  • 2
  • 28
  • 47

1 Answers1

1

The answer was even simpler than I expected:

$( document ).ajaxError( function( event, jqxhr, settings) {

    if (// some condition) {
        $.ajax(settings);
    }

});

The third parameter is a current Request

Odin Thunder
  • 3,284
  • 2
  • 28
  • 47