Side navigation
#7666 closed bug (fixed)
Opened November 30, 2010 09:26PM UTC
Closed November 30, 2010 10:24PM UTC
Documentation needs to be clearer on Ajax requests
Reported by: | schalk@ossreleasefeed.com | Owned by: | ajpiano |
---|---|---|---|
Priority: | low | Milestone: | 1.6 |
Component: | web | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
For a success callback the textStatus and XHR object will not be populated if the call is a jsonp cross-domain request. All other requests, even jsonp on the same domain (although rarely if ever used), will populate the XHR object as well as the textStatus.
Attachments (0)
Change History (7)
Changed November 30, 2010 09:31PM UTC by comment:1
Changed November 30, 2010 09:44PM UTC by comment:2
_comment0: | Cross-domain jsonp requests don't use XHR, this behavior is well documented on [http://api.jquery.com/jQuery.ajax/ jQuery.ajax()] \ \ > Some types of Ajax requests, such as JSONP ..., do not use XHR; in those cases the XMLHttpRequest parameter passed to the callback will be undefined. \ \ Actually the fact that jQuery uses XHR for non cross-domain jsonp requests is either a bug or needs to be documented. → 1291153704027383 |
---|---|
_comment1: | Cross-domain jsonp requests don't use XHR, this behavior is well documented on [http://api.jquery.com/jQuery.ajax/ jQuery.ajax()] \ \ > Some types of Ajax requests, such as JSONP ..., do not use XHR; in those cases the XMLHttpRequest parameter passed to the callback will be undefined. \ \ Actually the fact that jQuery uses XHR for non cross-domain jsonp requests is either a bug see #5955 → 1291153727019830 |
_comment2: | Cross-domain jsonp requests don't use XHR, this behavior is well documented on [http://api.jquery.com/jQuery.ajax/ jQuery.ajax()] \ \ > Some types of Ajax requests, such as JSONP ..., do not use XHR; in those cases the XMLHttpRequest parameter passed to the callback will be undefined. \ \ Actually the fact that jQuery uses XHR for non cross-domain jsonp requests is a bug see #5955 → 1291154105389068 |
component: | unfiled → ajax |
priority: | undecided → low |
Cross-domain jsonp requests don't use XHR, this behavior is well documented on jQuery.ajax()
Some types of Ajax requests, such as JSONP ..., do not use XHR; in those cases the XMLHttpRequest parameter passed to the callback will be undefined.
Actually the fact that jQuery uses XHR for non cross-domain jsonp requests is a bug see #5955 and either needs to get fixed or documented.
Changed November 30, 2010 09:49PM UTC by comment:3
resolution: | → invalid |
---|---|
status: | new → closed |
Changed November 30, 2010 10:02PM UTC by comment:4
I was writing this demo, based on your test case that showed the difference, so, enjoy... http://jsfiddle.net/rwaldron/tGHc5/4/
Changed November 30, 2010 10:14PM UTC by comment:5
component: | ajax → web |
---|---|
resolution: | invalid |
status: | closed → reopened |
there are a few things that could be improved about the documentation of jsonp
Changed November 30, 2010 10:14PM UTC by comment:6
owner: | → ajpiano |
---|---|
status: | reopened → assigned |
Changed November 30, 2010 10:24PM UTC by comment:7
resolution: | → fixed |
---|---|
status: | assigned → closed |
updated the docs to mention that error is not fired for jsonp requests, and that the 'textStatus' argument - in addition to the XHR - will also be undefined in callbacks.
You can see a sample here: http://jsfiddle.net/tGHc5/2/
What you will notice however, is that on error, the behavior is perfectly fine. So if you change the URL in ajaxSetup to for example 'nogo', the results will be as expected.