Jquery/formvalidator Ajax: the most reasonable solution to Chinese Garbled text

Source: Internet
Author: User

Recently, jquery encountered Chinese garbled characters. In fact, its Chinese garbled characters are because contenttype does not specify encoding,
You only need to search for contenttype in jquery. js.
Then add; charset = UTF-8 after application/X-WWW-form-urlencoded
Eventually changed to contenttype: "application/X-WWW-form-urlencoded; charset = UTF-8"

If you are using formvalidator, You need to modify a few places. I used formvalidator 3.3 to find two problems. Modify the formvalidator. JS File

1. garbled Chinese characters. First, modify the contenttype of the jquery library according to the above, and then search for ajaxvalid in formvalidator. js.

Delete encodeuricomponent () IN VaR parm = "clientid =" + ID + "&" + ID + "=" + encodeuricomponent (srcjo. Val ()
Change to VaR parm = "clientid =" + ID + "&" + ID + "=" + srcjo. Val.

2. Data always uses initialized data

Defines the parameter var ls_data = Setting. Data;
Find this code in (the next line of the code above) ls_url = ls_url + (ls_url.indexof ("? ")> 0? ("&" + Parm ):("? "+ Parm ));

Change to ls_data = ls_data + (ls_url.indexof ("? ")> 0? ("&" + Parm ):("? "+ Parm ));
Modify data: Setting. data to data: ls_data.

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.