下面我就为大家带来一篇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提交乱码的快速解决方法的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号