Bug Tracker

Opened 11 years ago

Closed 9 years ago

Last modified 7 years ago

#3227 closed bug (wontfix)

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:

Description

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

Change History (8)

comment:1 Changed 11 years ago by flesler

need: ReviewPatch
Owner: set to flesler
Status: newassigned

comment:2 Changed 10 years ago by dmethvin

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.

comment:3 Changed 9 years ago by jitter

Keywords: needsdocs needsreview added
Milestone: 1.31.next
Owner: flesler deleted
Priority: majorlow
Status: assignedopen
Version: 1.2.61.4.4

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.

comment:4 Changed 9 years ago by Rick Waldron

Keywords: ajaxrewrite added

comment:5 Changed 9 years ago by jaubourg

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.

comment:6 Changed 9 years ago by jaubourg

Keywords: needsreview removed
Owner: set to kswedberg
Status: openassigned

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

comment:7 Changed 9 years ago by jitter

Keywords: ajaxrewrite removed
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

comment:8 Changed 9 years ago by kswedberg

Keywords: needsdocs removed
Note: See TracTickets for help on using tickets.