Skip to content
A simple jquery 'plugin' to retry ajax requests.
CoffeeScript HTML
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

NOTE: I neither use nor maintain this project anymore.

This is a simple jquery 'plugin' to help with retrying ajax requests. It's not a real plugin because it doesn't use the plugin architecture; rather, it uses a single call to ajaxPrefilter to modify the way ajax requests work. This does not provide delays between attempts (backoff); there are other plugins that provide that kind of functionality.


Include the jquery-ajax-retry.js script on your page. (The JS is generated from the coffeescript).

  method: "get",
  url: "/some/path",
  dataType: "json",
  success: function(data, textStatus, jqXHR) { ... }
  error: function(jqXHR, textStatus, httpError) { ... }

  // retry options
  timeout: 3000,          // [required] You must provide a timeout to use retries
  maxTries: 3             // [required] How many times to retry.
  retryCodes: [404, 500]  // [optional] HTTP error codes on which to retry.


Might work with any 1.5+ version of jQuery. Tested with 1.7.2.


Taken from the technique here:


This work is under the MIT License

Something went wrong with that request. Please try again.