> I think it's a result of the $.ajax method's very ambitious scope. The > behavior can change quite a bit depending on the arguments, and many > argument combinations aren't valid. > > http://docs.jquery.com/Ajax/jQuery.ajax#options > > Just a few examples: jsonp and cross-domain json/script requests don't > support beforeSend, type!=GET, ifModified, dataFilter, timeout, > username, password, contentType, synchronous requests, the error > handler, and the ajaxSend/ajaxError events. They do support the other > global ajax events and the complete/success hander, but since they > don't have an xhr object that argument is passed in as undefined. > Cross-domain json/jsonp are treated as scripts; they do support > scriptCharset although the docs currently say it only applies to > dataType="script". > > Since jsonp and cross-domain json requests are transformed into script > tags but only under certain circumstances, it means that two requests > that vary only by their url parameter can behave very differently. > > It all makes sense when you know about the constraints of the > underlying technologies being used. Many users don't understand that > plumbing, though, and it's complex to explain in the docs -- look how > long it is already! > > I thought of one thing that might help: a matrix showing which options > apply to which dataType/xdomain combinations -- I can do that. I > wonder if it would be helpful to refactor the ajax functionality into > two or three consistent methods with fewer exceptions.
A matrix sounds awesome, I think it would help to make the functionality more specific. It seems like the issue is mostly documentation/education related, then. Things might have been clearer if we just kept jsonp separate from $.ajax, but I still think we made the right decision (we hide the specifics of the request medium, as best we can, in exchange for a simple interface). So yeah, any help on the docs here would be hugely appreciated. --John -- You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-...@googlegroups.com. To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=.