jQuery.fn.extend({
- // DEPRECATED
- loadIfModified: function( url, params, callback ) {
- this.load( url, params, callback, 1 );
- },
-
- load: function( url, params, callback, ifModified ) {
+ load: function( url, params, callback ) {
if ( jQuery.isFunction( url ) )
return this.bind("load", url);
url: url,
type: type,
data: params,
- ifModified: ifModified,
complete: function(res, status){
// If successful, inject the HTML into all the matched elements
- if ( status == "success" || !ifModified && status == "notmodified" )
+ if ( status == "success" || status == "notmodified" )
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
},
serialize: function() {
- return jQuery.param( this );
+ return jQuery.param(this.serializeArray());
},
-
- // DEPRECATED
- // This method no longer does anything - all script evaluation is
- // taken care of within the HTML injection methods.
- evalScripts: function(){}
-
+\r serializeArray: function() {\r
+ return this.map(function(){
+ return jQuery.nodeName(this, "form") ?
+ jQuery.makeArray(this.elements) : this;
+ })
+ .filter(function(){
+ return this.name && !this.disabled &&
+ (this.checked || /select|textarea/i.test(this.nodeName) ||
+ /text|hidden|password/i.test(this.type));
+ })
+ .map(function(i, elem){\r var val = jQuery(this).val();
+ return val == null ? null :
+ val.constructor == Array ?
+ jQuery.map( val, function(i, val){\r return {name: elem.name, value: val};
+ }) :
+ {name: elem.name, value: val};\r
+ }).get();\r }
});
// Attach a bunch of functions for handling common AJAX events
var jsc = (new Date).getTime();
jQuery.extend({
- get: function( url, data, callback, type, ifModified ) {
+ get: function( url, data, callback, type ) {
// shift arguments if data argument was ommited
if ( jQuery.isFunction( data ) ) {
callback = data;
url: url,
data: data,
success: callback,
- dataType: type,
- ifModified: ifModified
+ dataType: type
});
},
- // DEPRECATED
- getIfModified: function( url, data, callback, type ) {
- return jQuery.get(url, data, callback, type, 1);
- },
-
getScript: function( url, callback ) {
return jQuery.get(url, null, callback, "script");
},
});
},
- // DEPRECATED
- ajaxTimeout: function( timeout ) {
- jQuery.ajaxSettings.timeout = timeout;
- },
-
ajaxSetup: function( settings ) {
jQuery.extend( jQuery.ajaxSettings, settings );
},
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) );
// Return the resulting serialization
- return s.join("&");
+ return s.join("&").replace(/%20/g, "+");
}
});