jquery Serializearray (), serialize () Add data

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/csdnzhangtao5/article/details/52981541

The serialize (), Serializearray () methods are all jquery user serialized forms, serialization of data values for AJAX submissions

In Chrome's console we clearly see that Serializearray () returns a JSON array, each object of the array is made up of a JSON string, and we can see that each JSON string consists of two key-value pairs, each of which has a name, Value consists of, in fact, the value assigned to the JSON string by Serializearray (), which assigns the value of the name of each Dom in the form to a JSON string to the values of name,dom.

Then we just need to add the extra content:

var Dataparam = $ ("#updateChannelForm"). Serializearray ();

For example I want to add sex= "male"

Dataparam.push ({"name": "Sex", "value": "Male"}) it's OK.

We see that the Serialize () method serializes the contents of the form into a string

"id=58&channeltype=2&subtitle=591teststetets&extattrvalueid=599"

Then we just need to add the extra content:

var Dataparam = $ ("#updateChannelForm"). Serialize ();

For example I want to add sex= "male"

Dataparam =dataparam + "&" + "sex= male"

jquery Serializearray (), serialize () Add data

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.