Ticket #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: | |
| Blocking: | Blocked by: |
Description
With a request like $.ajax({ url: otherSite, dataType: 'jsonp' }) jQuery doesn't call the beforeSend callback.
Change History
comment:1 Changed 5 years ago by flesler
- need changed from Review to Patch
- Owner set to flesler
- Status changed from new to assigned
comment:2 Changed 4 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 3 years ago by jitter
- Status changed from assigned to open
- Priority changed from major to low
- Owner flesler deleted
- Version changed from 1.2.6 to 1.4.4
- Milestone changed from 1.3 to 1.next
- Keywords needsdocs needsreview added
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 2 years ago by rwaldron
- Keywords jsonp,needsdocs,needsreview,ajaxrewrite added; jsonp needsdocs needsreview removed
comment:5 Changed 2 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 2 years ago by jaubourg
- Keywords jsonp,needsdocs,ajaxrewrite added; jsonp,needsdocs,needsreview,ajaxrewrite removed
- Owner set to kswedberg
- Status changed from open to assigned
I'll assign to Karl but I think we pretty much covered it in our first documentation meeting.
comment:7 Changed 2 years ago by jitter
- Keywords jsonp,needsdocs added; jsonp,needsdocs,ajaxrewrite removed
- Status changed from assigned to closed
- Resolution set to wontfix
- Milestone changed from 1.6 to 1.5
Jaubourg already stated why not all callbacks will be called for jsonp requests. This will be covered in the documentation
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
