Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery serialize() method

jQuery serialize() method

jQuery AJAX methods jQuery AJAX methods

Example

Output the result of serializing form values:

$

(

"

button

"

)

.

click

(

function

(

)

{

$

(

"

div

"

)

.

text

(

$

(

"

form

"

)

.

serialize

(

)

)

;

}

)

;

Try it »


Definition and Usage

The serialize() method creates a URL-encoded text string by serializing form values.

You can select one or more form elements (such as input and/or textarea), or the form element itself.

The serialized values can be used in a URL query string when generating an AJAX request.


Syntax

$(

selector

).serialize()


jQuery AJAX methods jQuery AJAX methods