Skip to main content

Bug Tracker

Side navigation

#4734 closed bug (duplicate)

Opened June 06, 2009 03:04AM UTC

Closed October 21, 2010 01:24AM UTC

Last modified October 21, 2010 01:24AM UTC

$.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:
Description

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)
Change History (4)

Changed June 08, 2009 01:28AM UTC by dmethvin comment:1

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.

Changed June 08, 2009 03:06AM UTC by jaubourg comment:2

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/

Changed October 21, 2010 01:24AM UTC by snover comment:3

resolution: → duplicate
status: newclosed

Changed October 21, 2010 01:24AM UTC by snover comment:4

Duplicate of #5201.