Side navigation
#6161 closed bug (fixed)
Opened February 24, 2010 12:52PM UTC
Closed March 31, 2011 02:29PM UTC
ajaxComplete event does not fire when context is used
Reported by: | rv4wd | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.next |
Component: | ajax | Version: | 1.4.4 |
Keywords: | ajax,callbacks,events,context,ajaxrewrite | Cc: | |
Blocked by: | Blocking: |
Description
When you use an ajax request with a context, then the ajaxComplete, ajaxSuccess and ajaxError callbacks don't fire.
I don't know, if this is intended, but it prevents usage of ajaxComplete as a global callback for all requests which have "global=true" in their settings.
Bound event:
$('#messages').ajaxComplete(fn);
request:
$.ajax({
url: '/ajax',
global: true,
context: customObject
});
Attachments (0)
Change History (10)
Changed April 08, 2010 02:58PM UTC by comment:1
Changed May 07, 2010 01:43PM UTC by comment:2
same problem here, any ideas how to get around this?
Changed May 07, 2010 02:00PM UTC by comment:3
workaround: use .proxy() to give the context to your callback-function
Changed June 06, 2010 01:24AM UTC by comment:4
This happens because jQuery will trigger the “global” event on your context object if you have defined one instead of despatching it globally. This is intentional within the jQuery source but I don’t know why.
Changed November 19, 2010 08:12AM UTC by comment:5
keywords: | ajax, callbacks, events → ajax callbacks events context |
---|---|
milestone: | 1.4.2 |
priority: | → high |
status: | new → open |
version: | 1.4.1 → 1.4.4 |
Changed November 22, 2010 06:44AM UTC by comment:7
Changed December 27, 2010 10:37PM UTC by comment:8
keywords: | ajax callbacks events context → ajax,callbacks,events,context,ajaxrewrite |
---|
Changed March 31, 2011 05:37AM UTC by comment:9
milestone: | → 1.next |
---|
Still a valid bug in 1.5.2 RC1 - http://jsfiddle.net/danheberden/u7UvR/
Changed March 31, 2011 02:29PM UTC by comment:10
resolution: | → fixed |
---|---|
status: | open → closed |
@dan: the event bubbles properly: http://jsfiddle.net/st796/ , remember it's triggered on the context.
Now, back to the user's original use-case (using an OBJECT as a context), this has been fixed in 1.5.1 with these two commits:
- https://github.com/jquery/jquery/commit/485fa0c42a71b4decc9cb1ce08bb56efabcc76f3
- https://github.com/jquery/jquery/commit/5b421fed003e6704bd0fbba2dea5c1b6add2cf52
See http://jsfiddle.net/qZEnv/ as a proof.
*push*
Bug still needs review ;)