How to solve the garbled Ajax submission in IE

Source: Internet
Author: User
This article is mainly for everyone to bring an article of IE under the AJAX submission garbled fast solution. Small series feel very good, now share to everyone, also for everyone to make a reference. Follow the small series together to see it, hope to help everyone.

Add a protective measure to the position of Chinese characters: encodeURIComponent (ParentID)

function Loadcity (parentid) {var city = ' ${hotel.city} ';  $.ajax ({    URL: './listcity.jspx?prov= ' + encodeuricomponent (parentid),    type: ' GET ',    dataType: ' JSON ',    timeout:5000,    error:function () {alert (' Load city list failed! ');},    success:function (msg) {$ ("#city"). empty (); $.  Each (eval (msg), function (I, item) {if (item.city ==city) {$ ("<option value= '" + item.city + "' selected = ' selected ' >" + item.city + "</option>"). AppendTo ($ ("#city"));} else{$ ("<option value=" + item.city + ">" + item.city + "</option>"). AppendTo ($ ("#city"));}  );}  });}

Online said another kind of add ContentType method seems to use, O (︶^︶) o Alas, or self-reliable AH ~ ~

ContentType: ' application/x-www-form-urlencoded; Charset=utf-8 ',

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.