jQuery serializeArray() method
Example
Output the result of serializing form values as an array:
$
(
"
button
"
)
.
click
(
function
(
)
{
x
=$
(
"
form
"
)
.
serializeArray
(
)
; $.
each
(
x
,
function
(
i
,
field
)
{
$
(
"
#results
"
)
.
append
(
field
.
name
"
:
"
field
.
value
"
"
)
;
}
)
;
}
)
;
Try it »
Definition and Usage
The serializeArray() method creates an array of objects (with name and value) by serializing form values.
You can select one or more form elements (such as input and/or textarea), or the form element itself.
Syntax
$(
selector
).serializeArray()
jQuery AJAX methods