Php processes serialized jQueryserializeArray data

Source: Internet
Author: User
Describes several common forms processing functions of jquery: 1. serialize the Form Content element as a string, which is often used for ajax submission. $ (& Quot; form & quot;). serialize () & amp; nbsp; 2. & amp; nbsp; serializeArray () sequence

Describes several common forms processing functions of jquery:
1. serialize the Form Content element as a string, which is often used for ajax submission.
$ ("Form"). serialize ()

2. serializeArray () serializes table data and returns json structure data. Note that it returns a json object instead of a json string. If you use it to obtain form data for submission, the server may need to process it like this in php:

// JS var data = $ ("# form: input "). serializeArray (); data = JSON. stringify (data); post_var = {'action': 'process', 'data': data}; $. ajax ({..... etc // PHP $ data = json_decode (stripslashes ($ _ POST ['data']), true); print_r ($ data ); // this will print out the post data as an associative array

3. $. param () is used to serialize an array or object according to key/value.
$. Param ({a: [2, 3, 4]}) // "a = 2 & a = 3 & a = 4"

Related Article

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.