0

I have one ajax function, which may fail sometimes. I want to handle it by recalling the same ajax function.

My function:

$.ajax({
    url: url,
    data: data,
    dataType: "html",
    timeout:60000
}).done(function(content)){
    container.html(content);
}).fail(function(jqXHR, status, error)) {
    $.ajax(this);
}

When I execute the above function, the fail callback executing only once, I want it to be executed until it gets a success.

  • 1
    Does this answer your question? [https://stackoverflow.com/a/10024557/4910798](https://stackoverflow.com/a/10024557/4910798) – Alfred Aug 28 '20 at 07:00
  • Does this answer your question? [What's the best way to retry an AJAX request on failure using jQuery?](https://stackoverflow.com/questions/10024469/whats-the-best-way-to-retry-an-ajax-request-on-failure-using-jquery) – freedomn-m Aug 28 '20 at 09:43

0 Answers0