Bug Tracker

Opened 12 years ago

Closed 9 years ago

#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
Blocked by: Blocking:

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 (5)

comment:1 Changed 12 years ago by flesler

Cc: dalangalma flesler added
need: PatchTest Case

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

comment:2 Changed 12 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 11 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 9 years ago by snover

Status: newpending

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!

comment:5 Changed 9 years ago by trac-o-bot

Status: pendingclosed

Automatically closed due to 14 days of inactivity.

Note: See TracTickets for help on using tickets.