Permalink
Browse files

Success and error callbacks

  • Loading branch information...
1 parent cc8ebce commit ba01150800ca3d0f47f1990677d3c43beea6932c @drogus committed Jun 30, 2008
Showing with 12 additions and 2 deletions.
  1. +12 −2 jquery.uploadProgress.js
View
14 jquery.uploadProgress.js
@@ -47,6 +47,8 @@
start: function() {},
uploading: function() {},
complete: function() {},
+ success: function() {},
+ error: function() {},
timer: ""
}, options);
/* update uuid */
@@ -86,11 +88,19 @@ jQuery.uploadProgress = function(e, options) {
bar.width(Math.floor(upload.percents) + '%');
options.uploading(upload);
}
- /* we are done, stop the interval */
- if (upload.state == 'done') {
+
+ if (upload.state == 'done' || upload.state == 'error') {
window.clearTimeout(options.timer);
options.complete(upload);
}
+
+ if (upload.state == 'done') {
+ options.success(upload);
+ }
+
+ if (upload.state == 'error') {
+ options.error(upload);
+ }
}
});
};

0 comments on commit ba01150

Please sign in to comment.