我正在尝试将 javascript 对象发送到 VS 2010 中的 MVC 方法。使用 VS Web 服务器。
$.ajax({
type: "POST",
url: "@Url.Action("Filter", "Grid")",
dataType: "json",
data: {"data": JSON.stringify(filtersData) },
contentType: "application/json; charset=utf-8",
traditional: true,
success: function (data) {
alert("ok");
},
error:function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
添加 contentType 参数时会导致 500 错误。我究竟做错了什么?