jQuery param() method (original) (raw)

Last Updated : 11 Jul, 2023

The **param() method in jQuery is used to create a serialized representation of an object.

**Syntax:

$.param( object, trad )

**Parameters: This method accepts two parameters as mentioned above and described below:

****Example 1:**uses This example uses the param() method to create a serialized representation of an object.

html `

jQuery param() Method
<script src=

"" title="undefined" rel="noopener noreferrer">https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">

<h1 style="color:green;">
    GeeksForGeeks
</h1>

<h2>jQuery param() method</h2>

<button>Click</button>

<div></div>

<!-- Script using param() method -->
<script>
    $(document).ready(function () {

        personObj = new Object();

        personObj.Firstword = "Geeks";
        personObj.Secondword = "For";
        personObj.Thirdword = "Geeks";
        personObj.Wordcolor = "Green";

        $("button").click(function () {
            <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mi mathvariant="normal">&quot;</mi><mi>d</mi><mi>i</mi><mi>v</mi><mi mathvariant="normal">&quot;</mi><mo stretchy="false">)</mo><mi mathvariant="normal">.</mi><mi>t</mi><mi>e</mi><mi>x</mi><mi>t</mi><mo stretchy="false">(</mo></mrow><annotation encoding="application/x-tex">(&quot;div&quot;).text(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord">&quot;</span><span class="mord mathnormal">d</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord">&quot;</span><span class="mclose">)</span><span class="mord">.</span><span class="mord mathnormal">t</span><span class="mord mathnormal">e</span><span class="mord mathnormal">x</span><span class="mord mathnormal">t</span><span class="mopen">(</span></span></span></span>.param(personObj));
        });
    });
</script>

`

**Output:

jquery-53

****Example 2:**This example uses the param() method to create a serialized representation of an object.

html `

jQuery param() Method
<script src=

"" title="undefined" rel="noopener noreferrer">https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">

<h1 style="color:green;">
    GeeksForGeeks
</h1>

<h2>jQuery param() method</h2>

<button>Click</button>

<div></div>

<!-- Script using param() method -->
<script>
    $(document).ready(function () {

        personObj = new Object();

        personObj.Fullword = "GeeksForGeeks ";
        personObj.Wordcolor = " Green";

        $("button").click(function () {
            <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mi mathvariant="normal">&quot;</mi><mi>d</mi><mi>i</mi><mi>v</mi><mi mathvariant="normal">&quot;</mi><mo stretchy="false">)</mo><mi mathvariant="normal">.</mi><mi>t</mi><mi>e</mi><mi>x</mi><mi>t</mi><mo stretchy="false">(</mo></mrow><annotation encoding="application/x-tex">(&quot;div&quot;).text(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord">&quot;</span><span class="mord mathnormal">d</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord">&quot;</span><span class="mclose">)</span><span class="mord">.</span><span class="mord mathnormal">t</span><span class="mord mathnormal">e</span><span class="mord mathnormal">x</span><span class="mord mathnormal">t</span><span class="mopen">(</span></span></span></span>.param(personObj));
        });
    });
</script>

`

**Output:

jquery-54