> > $.ajax is already one of the most complex and least consistent methods
> > in jQuery, so if anything I'd like to see it get simpler.
>
> Can you expand on this? It'd probably be good to either document or
> fix the issues you're encountering.

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.

--

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=.


Reply via email to