Javatpoint Logo
Javatpoint Logo

jQuery param() method

The jQuery's param() method allows us to create a serialized representation of an object or an array. We can use these serialize values in the URL string when making an AJAX request.

This method has two parameters, obj and trad, in which the first one is mandatory, and the second parameter is optional to use.

Syntax

The parameter values of this method are defined as follows.

Parameter values

obj: It is the mandatory parameter. It can be an array or an object to serialize.

trad: This optional parameter is a Boolean value, which is used to specify whether or not to use the traditional style of param serialization.

Let's see some illustrations to understand how to use the param() method.

Example1

In this example, we are using the param() method for creating the serialized representation of an object. Here, there is an object named as student with some student details. We are implementing the param() method on the student object to create its serialized representation.

Test it Now

Output

After the execution of the above code, the output will be -

jQuery param() method

After clicking the given button, the output will be -

jQuery param() method

Example2

In this example, there are some complex objects. We are implementing the param() method on these complex objects to see the result. Here, we are using the decodeURIComponent to display the decoded object.

Here, there are two objects obj1 and obj2. We are implementing the param() method on these objects and display the result in decoded format.

After the execution of the above code, the output will be -

jQuery param() method

After clicking the given button, the output will be -

jQuery param() method




Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA