From: Stefan Petre Date: Thu, 16 Nov 2006 10:30:14 +0000 (+0000) Subject: if one value of key/value pairs is array then treat each array value in part X-Git-Tag: 1.0.4~39 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=317ea5caeacdae60ef759fd1e35c9219c9e14c87;p=jquery.git if one value of key/value pairs is array then treat each array value in part --- 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