【发布时间】:2023-03-22 10:13:01
【问题描述】:
我正在尝试将非拉丁字符传递给 mvc 控制器。但值始终为"??????"。这就是我所拥有的。知道如何将这种类型的值传递给控制器参数吗?
脚本
$.ajax({
url: 'FOV/MCI/Cars?model=Ферари',
dataType: 'html',
type: 'POST',
error: function (xhr) {
alert('error');
},
success: function (data) {
alert('success');
}
});
C#:
[HttpPost]
public ActionResult Cars(string model)
{
//here model is with value ??????
}
【问题讨论】:
-
需要在ajax请求中设置contentType contentType: "charset=utf-8"
标签: javascript c# jquery model-view-controller