I studied the IHA serialization problem last night. I used to think it was an advanced technology, so I often avoided it. Now I am wrong! ^_^ In fact, using serialization in. NET is very simple. I hope I can write this thing and give a small tip to
Reprinted from: http://blog.csdn.net/zqtsx/article/details/28655717Original form form value acquisition method (manual):[JavaScript]View PlainCopy
$.ajax ({
Type: "POST",
URL: "ajax.php",
Data: "name= the star &position=it
PHP serialize,unserialize function
We often see serialize,unserialize these two functions in PHP, so what are their roles?
Serialize can convert any data into a stored character oh, and then unserialize restore, here we look at
An instance.
Fuse Scene:
Original: MySQL in the result table img Field original storage string, content for a picture link;
Now: This field needs to store more than one picture link, 1-3 elements of the array of stroke;
There are two general
A problem was encountered today while serializing selectHtml:
1
2
3
The original approach:
Alert ($ (' select>option:selected '). Serialize ())//'
alert (typeof ' Select>option:selected '). Serialize (
Reference Code 1You can use the serialization and deserialization methods provided by the. NET to serialize the object into an XML string and then into the database, when you want to use the object, You can then deserialize the saved string in the
In jquery Ajax, data is treated as key-value pairs (key/value ).)When Using ajax to submit form data, you can use the serialize () method of jquery ajax to serialize the form to a key-Value Pair (key1 = value1 & key2 = value2 ...) And then
Serialize () The table contents of the sequence table are strings for Ajax requests.Serializearray () Serializes tabular elements (similar to the '. Serialize () ' method) to return the JSON data structure.. Serializearray ()Encodes a set of form
Storage and transport of PHP objects (serialization of Serialize objects)
Storage and transport of objects
In the actual project application, some tasks can not be completed in one or two pages, because the variables to the script after the
jquery's Serialize () method creates a URL-encoded text string by serializing the form value, we can select one or more form elements, or you can directly select the form to serialize it, such as:FormAction="">First Name:InputType= "text" Name= "
Serialization is the preservation of the state of an object (the amount of each property), which is then obtained at the appropriate time.When you use a class, it's all new!If serialize data is serialized later into the database mediumWhen you use
1.serialize () methodFormat: var data = $ ("form"). Serialize ();Function: Serializes the contents of the form into a single string.This way, when Ajax submits the form data, it is not necessary to enumerate each of the parameters. You only need to
The purpose of my Serialize method for using jquery is to conveniently collect form fields under form, but if you're not careful, the information you collect is not what you want.For example: We need to query the list by name, the name can be
1.Serialize() method format:var data = $ ("form"). Serialize (); Function: Serializes the contents of the form into a single string. This way, when Ajax submits the form data, it is not necessary to enumerate each parameter. Simply set the data
Definition and usageThe serialize () method creates a URL-encoded text string by serializing the form value.You can select one or more form elements (such as input and/or text boxes), or the form element itself.The serialized value can be used in
Sometimes we need to use the Ajax commit to submit the value of the form, so we need to use serialize () to get the value of the form. However, the values obtained are assumed to be in Chinese. will be garbled. Reasons and workarounds such as the
SerializeThe Sequence table table content is a string that is used for Ajax requests . Can be for the entire form, or only for a certain part.HTML Code:Results: Single Single2 Multiple Multiple2 Multiple3 check1 check2
Serialization of Chinese is garbled because. Serialize () called the Encodeurlcomponent method to encode the data
The solution is to decode it.
Reason:. Serialize () automatically invokes the encodeURIComponent method to encode the data
JQuery Ajax Serialize () method form submits data, there is a very strange problem, it seems that can not be taken to hide the value of the control. //Click the Submit button to save the data$ (' #btn_submitUser '). Click (function () {
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.