IE下Ajax提交乱码的快速解决方法
程序员文章站
2022-06-06 10:10:25
...
下面我就为大家带来一篇IE下Ajax提交乱码的快速解决方法。现在就分享给大家,也给大家做个参考。
哈哈,试了这么多还是encodeURIComponent管用啊!!!!
在汉字的位置加个保护措施: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('加载城市列表失败!'); }, 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")); } }); } }); }
上面是我整理给大家的,希望今后会对大家有帮助。
相关文章:
以上就是IE下Ajax提交乱码的快速解决方法的详细内容,更多请关注其它相关文章!
上一篇: 新零售的底层革命 社区团购将革很多人的命
下一篇: 秋季养生粥推荐 十款靓粥预防疾病补充营养