Home > Web Front-end > JS Tutorial > jQuery-serialize() method to output serialized form value_jquery

jQuery-serialize() method to output serialized form value_jquery

WBOY
Release: 2016-05-16 17:45:31
Original
1210 people have browsed it
Example
Output the result of serialized form value:
Copy code The code is as follows:

$("button").click(function(){
$("div").text($("form").serialize());
});

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 inputs and/or text boxes), or the form element itself.
Serialized values ​​can be used in URL query strings when generating AJAX requests.

Syntax
Copy code The code is as follows:

$(selector).serialize()

Detailed Description
.serialize() method creates a text string represented in standard URL encoding. It operates on a jQuery object that represents a collection of form elements.

There are several types of form elements:
Copy code The code is as follows:









5
6
7








.serialize() Methods that operate on jQuery objects that have selected individual form elements, such as ,