Retrying ajax calls using the deferred api
JavaScript
Switch branches/tags
Nothing to show
Pull request Compare This branch is 37 commits behind johnkpaul:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist
libs
src
test
.gitignore
LICENSE-MIT
README.md
grunt.js
package.json

README.md

jQuery Ajax Retry

Retry ajax calls using the deferred API

Getting Started

Download the production version or the development version.

In your web page:

<script src="jquery.js"></script>
<script src="dist/jquery.ajax-retry.min.js"></script>
<script>
jQuery(function($) {
  //this will try the ajax call three times in total 
  //if there is no error, the success callbacks will be fired immediately
  //if there is an error after three attempts, the error callback will be called

  $.ajax(options).retry(3).then(function(){
    alert("success!");
  });  

  //this has the same sematics as above, except will wait 3 seconds between attempts
  $.ajax(options).withTimeout(3000).retry(3).then(function(){
    alert("success!");
  });  
});
</script>

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Also, please don't edit files in the "dist" subdirectory as they are generated via grunt. You'll find source code in the "src" subdirectory!

Release History

(Nothing yet)

License

Copyright (c) 2012 John Paul
Licensed under the MIT license.