The ajax options parameter, unlike every other(?) options parameter,
is used "in place".

        ajax: function( s ) {
                // Extend the settings, but re-extend 's' so that it can be
                // checked again later (in the test suite, specifically)
                s = jQuery.extend(true, s, jQuery.extend(true, {},
jQuery.ajaxSettings, s));

This means you cant use the same options object (with modifications)
to successive calls to $.ajax. ie, I'd like to do:

var ajOpts = {...};
$.each(foo, function() { ajOpts.data.id = this.id; $.ajax(ajOpts) });

This would have worked if ajax were defined as:
        ajax: function( s ) {
                s = jQuery.extend(true, {}, jQuery.ajaxSettings, s);

which seems to be the "standard" way of doing things.

The comments say its done this way for the test suite - but surely the
test suite could just use a callback (eg beforeSend) to get the
modified object back?

Or am I just wrong to think that this should work?

Mark

--

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


Reply via email to