Adding in .bind(name, false), .unbind(name, false) support - an easy way to just...
[jquery.git] / src / ajax.js
index f514cae..08fa08b 100644 (file)
@@ -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 );
+               if ( typeof url !== "string" && _load ) {
+                       return _load.apply( this, arguments );
 
                // 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 {