jQuery | param() Method
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:
- object: It is a mandatory parameter which is used to specify an array or object to serialize.
- trad: It is an optional parameter and used to specify whether or not to use the traditional style of param serialization.
Example 1: This example use param() method to create serialized representation of an object.
<!DOCTYPE html> <html> <head> <title> jQuery param() Method </title> <script src= </script> </head> <body style="text-align:center;"> <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() { $("div").text($.param(personObj)); }); }); </script> </body> </html> |
Output:
Before click on the button:

After click on the button:

Example 2: This example use param() method to create serialized representation of an object.
<!DOCTYPE html> <html> <head> <title> jQuery param() Method </title> <script src= </script> </head> <body style="text-align:center;"> <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(){ $("div").text($.param(personObj)); }); }); </script> </body> </html> |
Output:
Before click on the button:

After click on the button:

Recommended Posts:
- jQuery | Misc param() Method
- HTML | param Tag
- HTML | <param> value Attribute
- HTML | param name Attribute
- jQuery | add() method with Example
- jQuery | get() Method
- jQuery | off() Method
- jQuery | is() Method
- jQuery | before() Method
- jQuery | css() Method
- jQuery | die() Method
- jQuery | fadeIn() Method
- jQuery | outerWidth() Method
- jQuery | html() Method
- jQuery | outerHeight() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



