What to do if Ajax submits garbled codes under IE
This article will explain in detail how to submit garbled codes for Ajax under IE. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
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 ('failed to load city list!');}, success: function (msg) {$("# city") .empty () $.each (eval (msg), function (I, item) {if (item.city = = city) {$("" + item.city + ") .appendTo ($(" # city "));} else {$("+ item.city +") .appendTo ($(" # city "));}});});})
Another method of adding contentType on the Internet doesn't seem to work. Alas, it's still reliable on your own.
ContentType: 'application/x-www-form-urlencoded; charset=utf-8'
This is the end of the article on "how to submit garbled codes in Ajax under IE". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.