Hello,

There is a task to re-call any ajax call that was interrupted in the error handler. The problem is that when you call this request again, the done callback does not work.

Sample code:

// any ajax call $.ajax(/** params **/).done(function(response) {console.log("success");}) // global ajax error handler $(document).ajaxError(function (jqXHR, status, error)) { $.ajax(error);//как вызвать здесь done из ajax запроса выше в случае его повторного успешного выполнения? } 

    1 answer 1

    $.ajax() returns promise . Promise cannot be restarted. The only way out is to wrap the code that makes an ajax call into a function and call it in .ajaxError() .

    • Thanks for the clarification - James