What is the use of param() method in JQuery .

devquora
devquora

Posted On: Feb 22, 2018

 

The param() method is used to represent an array or an object in serialize manner.
While making an ajax request we can use these serialize values in the query strings of URL.

Syntax:

$.param(object | array, boolValue)

“object | array” specifies an array or an object to be serialized.

“boolValue” specifies whether to use the traditional style of param serialization or not.

Example

personObj=new Object();
empObject.name="Ravi";
empObject.age="28";
empObject.dept="IT";
$("#clickme").click(function(){
$("span").text($.param(empObject));
});

It will set the text of span to “name=Ravi&age=28&dep=IT”

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    JQuery Interview Questions

    What is jQuery?

    jQuery is a lightweight JavaScript library which gives a quick and simple method for HTML DOM traversing and manipulati..

    JQuery Interview Questions

    What are the advantages of JQuery ?

    There are many advantages of JQuery. Some of them are :It is more like a JavaScript enhancement so there is no overhea..

    JQuery Interview Questions

    What are the different type of selectors in Jquery?

    There are 3 types of selectors in JqueryCSS Selector XPath Selector Custom Selector..