jquery core: #2548, #2170, #2188, #2099, #1170, #2558, #2521, #2119, #1271, #2453...
[jquery.git] / src / ajax.js
index b089f22..e0ab7f4 100644 (file)
@@ -1,7 +1,10 @@
 jQuery.fn.extend({
+       // Keep a copy of the old load
+       _load: jQuery.fn.load,
+       
        load: function( url, params, callback ) {
-               if ( jQuery.isFunction( url ) )
-                       return this.bind("load", url);
+               if ( typeof url != 'string' )
+                       return this._load( url );
 
                var off = url.indexOf(" ");
                if ( off >= 0 ) {
@@ -489,7 +492,7 @@ jQuery.extend({
                                                s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
                                        });
                                else
-                                       s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) );
+                                       s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) );
 
                // Return the resulting serialization
                return s.join("&").replace(/%20/g, "+");