Open In App

jQuery | Misc param() Method

Last Updated : 27 Mar, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
The param() method in jQuery is used to create a representation of an array or an object. This representation is created in a serialized way. This serialized values can be used in making an ajax request in URL. Syntax:
$.param(object, trad)
Parameter:
  • object: Specifies an array or object to serialize.
  • trad: A Boolean value specifying whether or not to use the traditional style of param serialization.
Examples: html
<!DOCTYPE html>
<html>

<head>
    <script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
  </script>
    
  <script>
        $(document).ready(function() {
            GFGlang = new Object();
            GFGlang.FirstLang = "C";
            GFGlang.SecondLang = "CPP";
            GFGlang.ThirdLang = "JAVA";
            GFGlang.FourthLang = "PYTHON";
          
            $("button").click(function() {
                $("div").text($.param(GFGlang));
            });
        });
    </script>
</head>

<body>
    <h1 style="color:green;"> 
                GeeksForGeeks 
            </h1>
    <button>
      Serialize object
  </button>

    <div></div>

</body>

</html>
Output: Before Click: After Click:

Next Article

Similar Reads