Open In App

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:

Example 1:uses This example uses the param() method to create a 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:

Example 2:This example uses the param() method to create a 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:


Article Tags :