Skip to content

Commit

Permalink
Save and call original ajax function
Browse files Browse the repository at this point in the history
  • Loading branch information
execjosh committed Jul 7, 2010
1 parent 62b5bdd commit fce39ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/jquery.ajaxretry.js
Expand Up @@ -31,14 +31,15 @@
slot_time: DEF_SLOT_TIME,
tick: NOP_FUNC
},
original_ajax_func = $.ajax,
ajaxWithRetry = function(settings){
var failures = 0,
opts = $.extend(true, {}, DEF_OPTS, settings.retry || {}),
orig_err_func = settings.error || NOP_FUNC;

function retry_delay(time) {
if (0 > time) {
$.ajax(settings);
original_ajax_func(settings);
}
else {
// Send tick event to listener
Expand Down Expand Up @@ -68,7 +69,7 @@
}
};

return $.ajax(settings);
return original_ajax_func(settings);
};

ajaxWithRetry.retrySetup = function(opts){
Expand Down

0 comments on commit fce39ca

Please sign in to comment.