English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery param() method

jQuery AJAX Methods

$ .param() method creates a serialized representation of an array or an object.

When making an AJAX request, you can use serialized values in the URL query string.

Syntax:

$.param(obj, traditional)

Example

Output the result of serializing the object:

myObj = new Object();
myObj.firstname = "Seagull";
myObj.lastname = "Anna";
$("button").click(function(){
  $("p").text($.param(myObj));
});
Test and see‹/›

Serialized Key/Value Object:

let myObj = {width:300, height:250};
let str = $.param(myObj);
$("button").click(function(){
  $("p").text(str);
});
Test and see‹/›

Parameter Value

NameDescription
objSpecify the array, object, or jQuery object to be serialized
traditional(Optional) Boolean value indicating whether to perform traditional 'shallow' serialization

jQuery AJAX Methods