jQuery Misc param() Method

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

Syntax

The syntax is as follows ?

$.param(obj, val)

Above, obj is the object to serialize, whereas Val specifies whether or not to use the traditional style of param serialization.

Example

Let us now see an example to implement the jQuery param() method?

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
   $(document).ready(function(){
      ob = new Object();
      ob.stdid = "S01";
      ob.roll = 3;
      $("button").click(function(){
         $("p").text($.param(ob));
      });
   });
</script>
</head>
<body>
<h2>Student Details</h2>
<p></p>
<button>Serialized Representation</button>
</body>
</html>

Output

This will produce the following output?

Click on the button to get serialized representation?

Updated on: 2026-03-11T22:50:47+05:30

200 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements