Skip to content

Commit

Permalink
if one value of key/value pairs is array then treat each array value …
Browse files Browse the repository at this point in the history
…in part
  • Loading branch information
stefanpetre committed Nov 16, 2006
1 parent 32816ef commit 317ea5c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/ajax/ajax.js
Expand Up @@ -892,8 +892,15 @@ jQuery.extend({
// Otherwise, assume that it's an object of key/value pairs
} else {
// Serialize the key/values
for ( var j in a )
s.push( j + "=" + encodeURIComponent( a[j] ) );
for ( var j in a ) {
//if one value is array then treat each array value in part
if (typeof a[j] == 'object') {
for (var k = 0; k < a[j].length; k++) {
s.push( j + "[]=" + encodeURIComponent( a[j][k] ) );
}
} else {
s.push( j + "=" + encodeURIComponent( a[j] ) );
}
}

// Return the resulting serialization
Expand Down

0 comments on commit 317ea5c

Please sign in to comment.