Skip to main content

Bug Tracker

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 rv4wd comment:1

*push*

Bug still needs review ;)

Changed May 07, 2010 01:43PM UTC by stimpson comment:2

same problem here, any ideas how to get around this?

Changed May 07, 2010 02:00PM UTC by stimpson comment:3

workaround: use .proxy() to give the context to your callback-function

Changed June 06, 2010 01:24AM UTC by snover 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 snover comment:5

keywords: ajax, callbacks, eventsajax callbacks events context
milestone: 1.4.2
priority: → high
status: newopen
version: 1.4.11.4.4

Changed November 22, 2010 05:17AM UTC by snover comment:6

#7017 is a duplicate of this ticket.

Changed November 22, 2010 06:44AM UTC by jitter comment:7

Changed December 27, 2010 10:37PM UTC by rwaldron comment:8

keywords: ajax callbacks events contextajax,callbacks,events,context,ajaxrewrite

Changed March 31, 2011 05:37AM UTC by danheberden 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 jaubourg comment:10

resolution: → fixed
status: openclosed

@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:

See http://jsfiddle.net/qZEnv/ as a proof.