Answers

Question and Answer:

  Home  JQuery Programmer

⟩ What is the use of param() method?

1. The param() method is used to represent an array or an object in serialize manner.

2. While making an ajax request we can use these serialize values in the query strings of URL.

3. Syntax: $.param(object | array, boolValue)

4. "object | array" specifies an array or an object to be serialized.

5. "boolValue" specifies whether to use the traditional style of param serialization or not.

For example:

personObj=new Object();

empObject.name="Arpit";

empObject.age="24";

empObject.dept="IT";

$("#clickme").click(function()

{

$("span").text($.param(empObject));

});

It will set the text of span to "name=Arpit&age=24&dep=IT"

 187 views

More Questions for you: