Bug Tracker

Opened 14 years ago

Closed 12 years ago

Last modified 12 years ago

#4734 closed bug (duplicate)

$.ajax Local Error Event Is Called Intermittently When Used With JSONP

Reported by: tidalwav1 Owned by:
Priority: minor Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: jsonp error ajaxerror getjson Cc:
Blocked by: Blocking:


I stumbled onto what could be a bug in JQuery's Ajax component.

I'm attempting to use $.ajax to work with JSONP (dataType : 'jsonp',) and it seems that this causes the local error event to not always get called when it should.

When the supplied URL results in a 404 page (with proper 404 HTTP headers,) execution of the script seems to simply halt instead of doing the desired behavior of calling the local error event. When the supplied URL is completely invalid (something such as "XYZ",) the local error event is called correctly.

Using getJSON() with the global ajaxError() event seems to exhibit the same behavior.

I asked about this problem in the JQuery IRC channel on Freenode, and an individual there thinks this behavior exists by design. If that's the case, maybe the JQuery Ajax API documentation should be modified to say that the Ajax error events can't be relied upon when using the JSONP dataType.

I've created a file that demonstrates the problem and have attached it to this ticket.

Can anyone shed any light on this?

Attachments (1)

ajax_jsonp_test.htm (1.5 KB) - added by tidalwav1 14 years ago.

Download all attachments as: .zip

Change History (5)

Changed 14 years ago by tidalwav1

Attachment: ajax_jsonp_test.htm added

comment:1 Changed 14 years ago by dmethvin

This definitely looks like a problem worth reporting and I'll keep the ticket open, but if you'd like some discussion on it you're better off asking on the forum.

comment:2 Changed 14 years ago by jaubourg

This issue is one of the main reasons I created a jsonp plugin with reliable error calls.

See http://code.google.com/p/jquery-jsonp/

comment:3 Changed 12 years ago by snover

Resolution: duplicate
Status: newclosed

comment:4 Changed 12 years ago by snover

Duplicate of #5201.

Note: See TracTickets for help on using tickets.