Bug Tracker

Opened 13 years ago

Closed 13 years ago

#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:
Blocked by: Blocking:


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 schalk@…

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.

comment:2 Changed 13 years ago by jitter

Component: unfiledajax
Priority: undecidedlow

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.

Last edited 13 years ago by jitter (previous) (diff)

comment:3 Changed 13 years ago by jitter

Resolution: invalid
Status: newclosed

comment:4 Changed 13 years ago by Rick Waldron

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 ajpiano

Component: ajaxweb
Resolution: invalid
Status: closedreopened

there are a few things that could be improved about the documentation of jsonp

comment:6 Changed 13 years ago by ajpiano

Owner: set to ajpiano
Status: reopenedassigned

comment:7 Changed 13 years ago by ajpiano

Resolution: fixed
Status: assignedclosed

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.

Note: See TracTickets for help on using tickets.