diff options
author | John Resig <jeresig@gmail.com> | 2007-01-14 21:49:59 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2007-01-14 21:49:59 +0000 |
commit | 34355cd6986d5939dc711c531263cb561cba5f24 (patch) | |
tree | 6903ce9d70aa0c481498183576a5f856d908da29 /src/ajax | |
parent | 866187fff66ef50b9c4b4c47f332f742c7546cc5 (diff) | |
download | jquery-34355cd6986d5939dc711c531263cb561cba5f24.tar.gz jquery-34355cd6986d5939dc711c531263cb561cba5f24.zip |
Converted a lot of for loops to use jQuery.each() instead.
Diffstat (limited to 'src/ajax')
-rw-r--r-- | src/ajax/ajax.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js index 34508437a..2ad93315d 100644 --- a/src/ajax/ajax.js +++ b/src/ajax/ajax.js @@ -789,8 +789,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 +799,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] ) ); |