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",
});
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiIn5GcuU2NmNjZilzN1cDNhRWM1ADMkFjMhRGZzIWMhJWOiVTMfdWbp9CXt92Yu4GZjlGbh5SZslmZxl3Lc9CX6MHc0RHaiojIsJye.png)
data傳中文,正确。
url: "/ProductTypeAndCat/AddType",
data: {typeName:typeName},
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(包含連結)。如您有任何疑問或者授權方面的協商,請給我留言。