jQuery | Misc param() Method

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <script src=
  </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>

chevron_right


Output:
Before Click:

After Click:



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.