Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Extend jQuery ajax function to retry requests and perform compensate action

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 index.htm
Octocat-spinner-32 jquery-1.8.2.js
Octocat-spinner-32 retryAjax.js
Octocat-spinner-32 test.html


I wanted a little wrapper function to retry ajax requests in the event of transient failures (particularly likely for mobile sites). This is my first stab at a little wrapper over jQuery's ajax function.


  • retries: The number of times to retry requests (default is 3)
  • backoff: Boolean option on whether to increase time between attempts (default false)
  • backoffInterval: Starting interval between wait time for requests (default 1000),
  • backOffFunc: Function to increase time between retries (default function multiples current backoffInterval value by 2 on each attempt)

Example usage:

        url: "badUrl.html",  
        error: function(){
            console.log('original error handler func');
        retries: 3,
        backoff: true

Something went wrong with that request. Please try again.