aboutsummaryrefslogtreecommitdiffstats
path: root/src/ajax
diff options
context:
space:
mode:
authorStefan Petre <stefan.petre@gmail.com>2006-11-16 10:30:14 +0000
committerStefan Petre <stefan.petre@gmail.com>2006-11-16 10:30:14 +0000
commit317ea5caeacdae60ef759fd1e35c9219c9e14c87 (patch)
tree5f8016865617d4151e6f8d0e38e9adebd54c129a /src/ajax
parent32816eff59095841e078cf5a7bf637ea64c4c801 (diff)
downloadjquery-317ea5caeacdae60ef759fd1e35c9219c9e14c87.tar.gz
jquery-317ea5caeacdae60ef759fd1e35c9219c9e14c87.zip
if one value of key/value pairs is array then treat each array value in part
Diffstat (limited to 'src/ajax')
-rw-r--r--src/ajax/ajax.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js
index f9d46503a..42bc54b6e 100644
--- a/src/ajax/ajax.js
+++ b/src/ajax/ajax.js
@@ -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