0

I have a 2-part question.

  1. How can I globally handle errors in Parse (Backbone)
  2. Such that whenever a connection error occurs, an alert is shown and the request is resent after the alert is hidden.

Part 1 is already answered here. My confusion is in resending the request when the global error handler expressed in that answer doesn't point to the location of the original request, as well as the success and error callbacks it defines.

1 Answer 1

1

jQuery offers a very convenient way,

$(document).ajaxError(function(event, request, settings) {
    setTimeout( function(){
       $.ajax(settings);
    }, 2000)
});

The key part is the settings parameter which contains the original settings passed to $.ajax which you can pass again to a new ajax request

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.