<pclass="desc"><strong>Description: </strong>Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. </p>
<spanclass="versionAdded">version added: <ahref="/category/version/1.4/">1.4</a></span>jQuery.param( obj, traditional )</h4>
<pclass="arguement"><strong>obj</strong>An array or object to serialize.</p>
<pclass="arguement"><strong>traditional</strong>A Boolean indicating whether to perform a traditional "shallow" serialization.</p>
</li>
</ul>
<divclass="longdesc">
<p>This function is used internally to convert form element values into a serialized string representation (See <ahref="/serialize/">.serialize()</a> for more information).</p>
<p>As of jQuery 1.3, the return value of a function is used instead of the function as a String.</p>
<p>As of jQuery 1.4, the <code>$.param()</code> method serializes deep objects recursively to accommodate modern scripting languages and frameworks such as PHP and Ruby on Rails. You can disable this functionality globally by setting <code>jQuery.ajaxSettings.traditional = true;</code>.</p>
<p>Note: Because some frameworks have limited ability to parse serialized arrays, we should exercise caution when passing an <code>obj</code> argument that contains objects or arrays nested within another array.</p>
<p>In jQuery 1.4 HTML5 input elements are serialized, as well.</p>
<p>We can display a query string representation of an object and a URI-decoded version of the same as follows:</p>
<pre>var myObject = {
a: {
one: 1,
two: 2,
three: 3
},
b: [1,2,3]
};
var recursiveEncoded = $.param(myObject);
var recursiveDecoded = decodeURIComponent($.param(myObject));
alert(recursiveEncoded);
alert(recursiveDecoded);
</pre>
<p>The values of <code>recursiveEncoded</code> and <code>recursiveDecoded</code> are alerted as follows:</p>