X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;ds=sidebyside;f=src%2Fajax.js;h=7b15a1d80f358b4fa296767df322f90939e6b77c;hb=9195107dbb13ad34ae4e9f7cb1df5d79e4748560;hp=f514caee73bcdb9d864b547fc0e3abef08c39fea;hpb=54bd004e53b4d89e9e7e7533f11c23ff99f70d73;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index f514cae..7b15a1d 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -6,15 +6,15 @@ var jsc = now(), rquery = /\?/, rts = /(\?|&)_=.*?(&|$)/, rurl = /^(\w+:)?\/\/([^\/?#]+)/, - r20 = /%20/g; + r20 = /%20/g, -jQuery.fn.extend({ - // Keep a copy of the old load - _load: jQuery.fn.load, + // Keep a copy of the old load method + _load = jQuery.fn.load; +jQuery.fn.extend({ load: function( url, params, callback ) { if ( typeof url !== "string" ) { - return this._load( url ); + return _load.call( this, url ); // Don't do a request if no elements are being requested } else if ( !this.length ) { @@ -624,7 +624,7 @@ jQuery.extend({ // If traditional, encode the "old" way (the way 1.3.2 or older // did it), otherwise encode params recursively. for ( var prefix in a ) { - buildParams( traditional ? prefix : prefix.replace(/[\[\]]/g, ""), a[prefix] ); + buildParams( prefix, a[prefix] ); } } @@ -635,7 +635,7 @@ jQuery.extend({ if ( jQuery.isArray(obj) ) { // Serialize array item. jQuery.each( obj, function( i, v ) { - if ( traditional ) { + if ( traditional || /\[\]$/.test( prefix ) ) { // Treat each array item as a scalar. add( prefix, v ); } else {