Example of serialize () usage in JQuery _ jquery

Source: Internet
Author: User
This article mainly introduces the usage of serialize () in JQuery. The example analyzes the functions, definitions, and related usage skills of the serialize () method, for more information about how to use serialize () in JQuery, see the following example. Share it with you for your reference. The specific analysis is as follows:

I. serialize () definition and usage:

The serialize () method creates a standard URL-encoded text string by serializing the form value. its operation object is a jQuery object representing the form element set. You can select one or more form elements (such as input or text box) or form elements. Serialized values can be used in URL query strings when an AJAX request is generated.

Syntax:

$ (Selector). serialize ()

Detailed description

1. the serialize () method creates a text string encoded with a standard URL. Its operation object is a jQuery object that represents the form element set.

2. the serialize () method can operate jQuery objects that have selected individual form elements, such,And. However, Select// Use: $ ("# form1"). serialize ();The value cannot be obtained. II. serialize () instance in JQuery 1. ajax serialize () The code is as follows:$. Ajax ({Type: "POST ",DataType: "json ",Url: ajaxCallBack,Data: $ ('# myForm'). serialize (), // ID of the form to be submittedSuccess: function (msg ){Alert (msg );}});2. serialize () serialized form instance The code is as follows:

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.