Jquery.serialize () function

Source: Internet
Author: User

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:

    1. form controls that are not in the <form> tab are not submitted
    2. form controls without a name attribute are not committed
    3. form controls with the disabled property are not committed
    4. form controls that are not selected are not committed.

Jquery.serialize () function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.