Skip to main content

Bug Tracker

Side navigation

#3227 closed bug (wontfix)

Opened August 07, 2008 02:43AM UTC

Closed January 28, 2011 01:21AM UTC

Last modified March 14, 2012 09:29PM UTC

JSONP requests don't trigger AJAX callbacks

Reported by: reedom Owned by: kswedberg
Priority: low Milestone: 1.5
Component: ajax Version: 1.4.4
Keywords: jsonp Cc:
Blocked by: Blocking:

With a request like $.ajax({ url: otherSite, dataType: 'jsonp' }) jQuery doesn't call the beforeSend callback.

Attachments (0)
Change History (8)

Changed August 07, 2008 01:11PM UTC by flesler comment:1

need: ReviewPatch
owner: → flesler
status: newassigned

Changed May 16, 2009 02:21AM UTC by dmethvin comment:2

The beforeSend function is passed the xhr object used to make the request. Since jsonp requests don't have an xhr, that would be problematic. There are several other options with a similar issue, plus all the global ajax events.

I am starting to think that jsonp is sufficiently different that it should have its own method.

Changed December 03, 2010 04:22PM UTC by jitter comment:3

keywords: jsonpjsonp needsdocs needsreview
owner: flesler
priority: majorlow
status: assignedopen

As jsonp uses a <script> tag for doing jsonp requests there are quite a few callbacks that don't get triggered. According to my test case these are the following beforeSend, ajaxSend, dataFilter, error, ajaxError, ajaxStop. This needs some discussion to determine which events should be called and for which we can get away with updating the documentation.

Changed December 27, 2010 10:36PM UTC by rwaldron comment:4

keywords: jsonp needsdocs needsreviewjsonp,needsdocs,needsreview,ajaxrewrite

Changed January 09, 2011 03:35PM UTC by jaubourg comment:5

In new implementation, beforeSend and dataFilter are always called, no matter the request type.

error, ajaxStart, ajaxStop, ajaxSend, ajaxError will be called if the unerlying tranport ensures completion (error detection) so cross-domain script & jsonp requests will never call them.

Changed January 14, 2011 03:29AM UTC by jaubourg comment:6

keywords: jsonp,needsdocs,needsreview,ajaxrewritejsonp,needsdocs,ajaxrewrite
owner: → kswedberg
status: openassigned

I'll assign to Karl but I think we pretty much covered it in our first documentation meeting.

Changed January 28, 2011 01:21AM UTC by jitter comment:7

keywords: jsonp,needsdocs,ajaxrewritejsonp,needsdocs
milestone: 1.61.5
resolution: → wontfix
status: assignedclosed

Jaubourg already stated why not all callbacks will be called for jsonp requests. This will be covered in the documentation

Changed February 03, 2011 05:31PM UTC by kswedberg comment:8

keywords: jsonp,needsdocsjsonp