Skip to main content

Bug Tracker

Side navigation

#7017 closed bug (duplicate)

Opened September 09, 2010 02:08PM UTC

Closed November 22, 2010 05:17AM UTC

Last modified March 13, 2012 10:55PM UTC

Global Ajax Events ajaxSend, ajaxSuccess, ajaxError and ajaxComplete do not work

Reported by: zorneck Owned by:
Priority: undecided Milestone:
Component: ajax Version: 1.4.2
Keywords: global ajax events Cc:
Blocked by: Blocking:
Description

The global ajax events ajaxSend, ajaxSuccess, ajaxError and ajaxComplete do not work since version 1.4.0.

The events ajaxStart and ajaxStop works fine.

Example:

$('body').ajaxSuccess(function() {

alert('test');

});

this do not work!

I hope it will be fixed until version 1.4.3

Attachments (3)
  • ajaxtest.html (0.0 KB) - added by zorneck September 22, 2010 12:12PM UTC.

    Something to reload

  • index.html (0.4 KB) - added by zorneck September 22, 2010 12:11PM UTC.

    The test start page

  • mytest.js (0.9 KB) - added by zorneck September 22, 2010 12:11PM UTC.

    The javascript test code

Change History (10)

Changed September 09, 2010 02:23PM UTC by john comment:1

resolution: → worksforme
status: newclosed

Do you have more details? They appear to work in all of your test cases.

Changed September 09, 2010 03:41PM UTC by zorneck comment:2

resolution: worksforme
status: closedreopened

I currently use version 1.4.2. I tested these events in firefox 3.6.9 and in Chrome.

In the meantime I searched the source code of jQuery 1.4.2 for these events, and found, that they are called wrong, I think.

The working events ajaxStart and ajaxStop are called by e.g.:

jQuery.event.trigger("ajaxStart");

The other global ajax events are called e.g.:

trigger("ajaxSuccess");

I think the last example is the bug.

Please test it, and you will see it.

Changed September 09, 2010 03:54PM UTC by john comment:3

resolution: → worksforme
status: reopenedclosed

No, that is to be expected - start and stop are different from the success/complete/error events.

As mentioned before, we already do test this and, in fact, have very good coverage:

http://github.com/jquery/jquery/blob/master/test/unit/ajax.js

A specific test case will be required in order to examine this further.

Changed September 10, 2010 09:19AM UTC by zorneck comment:4

resolution: worksforme
status: closedreopened

Ok, I found out, what the problem is, I set the context to this ('this' is in this case my object that makes the ajax call):

jQuery.ajax({

url: 'some_url.html',

context: this

});

In this case the mentioned global ajax events will not work. Is this a bug, or should it be like this?

Changed September 21, 2010 02:36PM UTC by jishan comment:5

I can confirm this bug. jQuery 1.4.2 doesn't fire any ajax callbacks on Firefox 4 beta 6 while the older version 1.3.2 works fine. It also works fine on FF 3.6.10.

Changed September 22, 2010 12:16PM UTC by zorneck comment:6

I added my test code, where you can see the problem. When you click the "Start Ajax Test" button the global events ajaxSend, ajaxSuccess, ajaxError and ajaxComplete will not fire.

The reason for this is the changed context of the ajax call.

Changed October 13, 2010 01:44PM UTC by zorneck comment:7

Here is my jsFiddle Test.

Run the test, click on "Start Ajax Test", and see that the global ajax events ajaxSend, ajaxSuccess, ajaxError and ajaxComplete do not work (no alert will be called).

Changed November 12, 2010 02:40AM UTC by snover comment:8

milestone: 1.4.3

Resetting milestone to future.

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

priority: → undecided
resolution: → duplicate
status: reopenedclosed

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

Duplicate of #6161.