Ticket #7666 (closed bug: fixed)
Documentation needs to be clearer on Ajax requests
| Reported by: | schalk@… | Owned by: | ajpiano |
|---|---|---|---|
| Priority: | low | Milestone: | 1.6 |
| Component: | web | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
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
comment:2 Changed 2 years ago by jitter
- Priority changed from undecided to low
- Component changed from unfiled to ajax
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:4 Changed 2 years ago by rwaldron
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 2 years ago by ajpiano
- Status changed from closed to reopened
- Resolution invalid deleted
- Component changed from ajax to web
there are a few things that could be improved about the documentation of jsonp
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

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.