JQuery serialize () serializeArray (), jquery form serialization
1. serialize () method
Format: var data = $ ("form"). serialize ();
Function: serialize the form content into a string.
In this way, when submitting form data through ajax, you do not
Serialize the form content as a json object, and serialize the form json
SourceCode:
1 ; (function ($) { 2 $.fn.extend({ 3 serializeJson: function () { 4 var json = {}; 5 $(this.serializeArray()).each(function ()
This article covers PHP serialize serialized data and JSON formatted data analysis. For more information, see
This article covers PHP serialize serialized data and JSON formatted data analysis. For more information, see
PHP serialize
The form form has a serialize () method. The ability to serialize the values of the form, but this method of jquery provides a way to serialize the data into a form similar to the following:A=1&b=2&c=3&d=4jquery does not provide a way to serialize
The content of this article is PHP serialize serialized data and JSON formatted data analysis. if you need it, refer to PHP serialize to serialize variables, return a string expression with variable types and structures, while JSON is a lighter and
The content of this article is PHP serialize serialized data and JSON formatted data analysis. if you need it, refer to PHP serialize to serialize variables, return a string expression with variable types and structures, while JSON is a lighter and
$.post, $.get is a simple method, if you want to deal with complex logic, still need to use the Jquery.ajax ()I. General format of $.ajax$.ajax ({Type: ' POST ',URL: URL ,Data: data ,Success: Success ,DataType: dataType});Second, the parameter
In jquery Ajax, data is sent to the server in the form of a key-value pair (Key/value), which can be serialized as a key-value pair using the jquery Ajax Serialize () method form when submitting form data using AJAX (key1=value1&key2= Value2 ... )
JSON is based on a subset of JavaScript Programming Language, Standard ECMA-262 3rd Edition-December 1999. JSON uses a completely language-independent text format, but it also uses a habit similar to the C language family (including C, C ++, C #,
In jquery, we can directly use serialize () to convert ajax submitted forms. In this way, the input in the form name is converted to the get method. If we have a large number of parameters, we do not need to fill them out.
Data in jQuery ajax is
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.