jquery ajax 提交到后台 乱码解决方案:
设置:contentType: "application/x-www-form-urlencoded; charset=utf-8",
function modifyAddress(){
var params_save = $('#addressForm').serialize();
var addressId = $("#j_addressId").val();
$.ajax({
url:'/mall/modifyAddress',
type:'POST',
dataType:'json',
contentType: "application/x-www-form-urlencoded; charset=utf-8",
data:params_save,
success:function(data){
if(data.success){
location.href="/mall/getAddressList?id="+itemId+"&openId=${openId}"
}else{
$("#j_address_msg").html(data.message);
showModifyMsgDIV();
}
}
});
}

本文介绍了解决使用jQuery AJAX提交数据到后台时出现乱码问题的方法,通过设置contentType参数为application/x-www-form-urlencoded;charset=utf-8来确保数据正确传输。
181

被折叠的 条评论
为什么被折叠?



