#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 14 years ago by
need: | Review → Patch |
---|---|
Owner: | set to flesler |
Status: | new → assigned |
comment:2 Changed 14 years ago by
comment:3 Changed 12 years ago by
Keywords: | needsdocs needsreview added |
---|---|
Milestone: | 1.3 → 1.next |
Owner: | flesler deleted |
Priority: | major → low |
Status: | assigned → open |
Version: | 1.2.6 → 1.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 12 years ago by
Keywords: | ajaxrewrite added |
---|
comment:5 Changed 12 years ago by
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 12 years ago by
Keywords: | needsreview removed |
---|---|
Owner: | set to kswedberg |
Status: | open → assigned |
I'll assign to Karl but I think we pretty much covered it in our first documentation meeting.
comment:7 Changed 12 years ago by
Keywords: | ajaxrewrite removed |
---|---|
Milestone: | 1.6 → 1.5 |
Resolution: | → wontfix |
Status: | assigned → closed |
Jaubourg already stated why not all callbacks will be called for jsonp requests. This will be covered in the documentation
comment:8 Changed 12 years ago by
Keywords: | needsdocs removed |
---|
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.