jQuery.serialize()
function is used to serialize a set of form elements and encode the contents of the form into a string for submission.
jQuery.serialize()函数
Often used to serialize the contents of a form for use in AJAX submissions .
The function is mainly based on the name and value of the valid form control used for submission, stitching them into a text string that can be directly used for form submission, which has been processed by standard URL encoding (character set encoding UTF-8).
Specific examples:
<form id= "Supplier-search-form" > <input type= "text" value= "class=" Organization-input "> < Input type= "text" value= "class=" Txt_input order-startdate "id=" StartDate "name=" StartTime "> <input Type= "text" value= "class=" Txt_input order-enddate "id=" EndDate "name=" EndTime "> <input type= " button " id= "Schedule-search-button" value= "Query" > <a id= "Schedule-export-button" href= "javascript:;" > Export </a></form>
Execute Jquery.serialize (), return string: starttime=2015&endtime=2016
The function is not serialized and does not require a submitted form control, which is consistent with the regular form submission behavior.
For example:
- form controls that are not in the <form> tab are not submitted
- form controls without a name attribute are not committed
- form controls with the disabled property are not committed
- form controls that are not selected are not committed.
Jquery.serialize () function