Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to reuse callbacks from previous XHR request? #9

Open
GeReV opened this issue Sep 24, 2013 · 2 comments
Open

Possible to reuse callbacks from previous XHR request? #9

GeReV opened this issue Sep 24, 2013 · 2 comments

Comments

@GeReV
Copy link

GeReV commented Sep 24, 2013

I have a configuration where I add a retry to every request globally via ajaxPrefilter, for cases where I get timeouts from Heroku.

It goes along the lines of:

jqXHR
  .retry({
    times: 2,
    statusCodes: [503]
  })
  .fail(function(xhr) {
    alert(...);
  });

This means any done callbacks are set previously to using retry.
Thing is, when a 503 error is returned, followed by a success, the success callbacks aren't called.

@johnkpaul
Copy link
Owner

Hmm, I see what you mean. I need to think about how to handle this. For your specific example, I think that you can work around by using .then(successHandler, failureHandler) instead of .fail.

@GeReV
Copy link
Author

GeReV commented Sep 28, 2013

At this point, in my specific case, I don't have direct access to the handlers, since I do this globally, but set the handlers initially at a different point.

There might be a way to work around this, but I couldn't find a way that doesn't require changing my original AJAX call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants