X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fajax%2Fajax.js;h=87fe73b943dc232769173bd7afc13526f7e3228b;hb=5ebd5f604ac90dae6381f59cfa637621faabf932;hp=34508437a143e3c5f392798fb72701ecf399ba65;hpb=259131966049cd879dbcecf222afe1457b03db60;p=jquery.git diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js index 3450843..87fe73b 100644 --- a/src/ajax/ajax.js +++ b/src/ajax/ajax.js @@ -55,7 +55,7 @@ jQuery.fn.extend({ // If the second parameter was provided if ( params ) // If it's a function - if ( jQuery.isFunction( params.constructor ) ) { + if ( jQuery.isFunction( params ) ) { // We assume that it's the callback callback = params; params = null; @@ -457,7 +457,8 @@ jQuery.extend({ timeout: 0, contentType: "application/x-www-form-urlencoded", processData: true, - async: true + async: true, + data: null }, // Last-Modified header cache for next request @@ -789,8 +790,9 @@ jQuery.extend({ // of form elements if ( a.constructor == Array || a.jquery ) // Serialize the form elements - for ( var i = 0; i < a.length; i++ ) - s.push( encodeURIComponent(a[i].name) + "=" + encodeURIComponent( a[i].value ) ); + jQuery.each( a, function(){ + s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) ); + }); // Otherwise, assume that it's an object of key/value pairs else @@ -798,8 +800,9 @@ jQuery.extend({ for ( var j in a ) // If the value is an array then the key names need to be repeated if ( a[j].constructor == Array ) - for ( var k = 0; k < a[j].length; k++ ) - s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j][k] ) ); + jQuery.each( a[j], function(){ + s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) ); + }); else s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) );