Skip to content

jQuery.param: Document standaloneKeys argument #1162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions entries/jQuery.param.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<argument name="traditional" type="Boolean">
<desc>A Boolean indicating whether to perform a traditional "shallow" serialization.</desc>
</argument>
<argument name="standaloneKeys" type="Boolean">
<desc>A Boolean indicating whether to use abbreviated serialization of keys with null values</desc>
</argument>
</signature>
<desc>Create a serialized representation of an array, a plain object, or a jQuery object suitable for use in a URL query string or Ajax request. In case a jQuery object is passed, it should contain input elements with name/value properties.</desc>
<longdesc>
Expand Down Expand Up @@ -87,6 +90,16 @@ alert( shallowDecoded );
<br/>
<samp>a=[object+Object]&amp;b=1&amp;b=2&amp;b=3</samp>
</p>
<p>To abbreviate the serialization of keys with null values, we can set the <code>standaloneKeys</code> argument to <code>true</code></p>
<pre><code>
var myObject = {
x: 1,
y: null
};
var abbreviatedSerialization = $.param( myObject, false, true );

alert( abbreviatedSerialization );
</code></pre>
</longdesc>
<example>
<desc>Serialize a key/value object.</desc>
Expand Down