Opened 13 years ago
Closed 13 years ago
#7666 closed bug (fixed)
Documentation needs to be clearer on Ajax requests
Reported by: | 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.
Change History (7)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
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.
comment:3 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:4 Changed 13 years ago by
I was writing this demo, based on your test case that showed the difference, so, enjoy... http://jsfiddle.net/rwaldron/tGHc5/4/
comment:5 Changed 13 years ago by
Component: | ajax → web |
---|---|
Resolution: | invalid |
Status: | closed → reopened |
there are a few things that could be improved about the documentation of jsonp
comment:6 Changed 13 years ago by
Owner: | set to ajpiano |
---|---|
Status: | reopened → assigned |
comment:7 Changed 13 years ago by
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.