url传中文,乱码,即便charset为 UTF-8,
$.ajax({
type: "POST",
cache: false,
url: "/ProductTypeAndCat/AddType?typeName=" + typeName,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
datatype: "JSON",
});
data传中文,正确。
$.ajax({
type: "POST",
cache: false,
url: "/ProductTypeAndCat/AddType",
data: {typeName:typeName},
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
datatype: "JSON",
success: function (data) {
if (data.F == 0) {
alert("添加陈功");
location.href = "/Admin/ProductType";
}
else {
alert(data.M);
}
},
error: function (xhr, status, error) {
alert(error);
}
});
本文基于
Creative Commons Attribution 2.5 China Mainland License发布,欢迎转载,演绎或用于商业目的,但是必须保留本文的署名
http://www.cnblogs.com/luminji(包含链接)。如您有任何疑问或者授权方面的协商,请给我留言。