Ticket #3362 (closed enhancement)
beforeComplete event for $.ajax
| Reported by: | dalangalma | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.3 |
| Component: | ajax | Version: | 1.2.6 |
| Keywords: | Cc: | dalangalma, flesler | |
| Blocking: | Blocked by: |
Description
While the complete handler is useful, it fires *after* error and success handlers. It'd be nice to have a version that fires *before* both error and success. That way you could have a common place to do anything that needs to be cleaned up before you fire either the success or error handler.
Change History
comment:1 Changed 5 years ago by flesler
- Cc dalangalma, flesler added
- need changed from Patch to Test Case
comment:2 Changed 5 years ago by dalangalma
I'm not sure what you mean - I'm looking for something new. I'd be able to say something like:
$.ajax({
url: ...,
data: ...,
beforeComplete: function() { alert("I fire first"); },
success: function() { alert("I fire next if the request was successful."); },
error: function() { alert("I fire next if the request was erroneous."); },
complete: function() { alert("I fire after either success or error"); }
});
comment:3 Changed 4 years ago by robustsolution
I think no need to have this callback since in case of success the datafilter callback does what you want and in case of error the error callback does what you want
comment:4 Changed 3 years ago by snover
- Status changed from new to pending
This ticket has been marked as missing a test case. In an effort to reduce the number of outstanding tickets in the bug tracker, it will be closed automatically in 30 days. In order to prevent this from happening, please provide a working test case. If a test case has already been provided and our records are wrong, please respond to the ticket so that it can be fixed. Thank you!
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Could you provide a test case ? a minimalistic html file with the requires html and js to reproduce the problem. Thanks.