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();
			}
		}
	});
}

 

发表评论

邮箱地址不会被公开。