For the solution to converting the serialize method of jquery into a space of +, jqueryserialize
Jquery's serialize () method can be used to serialize individual tables. This is a convenient feature, but the following problems are found in actual use:
For example:
<Textarea name = "content"> abc 123 </textarea>
After the serialize () method is executed, the string abc + 123 is obtained;
That is, the serialization method of jquery escapes spaces and converts them to the plus sign (+.
Some code of the serialize method in jquery is as follows:
//.................
//.................
Return s. join ("&"). replace (// g, "+"); // replace the space with the + sign
After testing, the serialize () method escapes % 2B for the true "+", so you can safely Replace the result after serialize ().
Example:
<Textarea name = "content"> abc + 123 + 456 </textarea>
Jquery code:
Var a = $ ('$ frm1'). serialize (); // serialization. By default, encodeURIComponent () is called for encoding.
Alert (a); // content = abc ++ 123 ++ 456
Var B = a. replace (/\ +/g, ""); // g indicates that all matching strings are replaced.
B = decodeURIComponent (B); // decode the content after serialize.
Alert (B); // content = abc+ 123 + 456
So far, the problem has been solved.