Jquery post数据未到达控制器
我有以下jqueryJquery post数据未到达控制器,jquery,ajax,asp.net-mvc,Jquery,Ajax,Asp.net Mvc,我有以下jquery $('#example').tableDnD({ onDrop: function (table, row) { alert(JSON.stringify($('#example').tableDnDSerialize())); var data = JSON.stringify($('#example').tableDnDSerialize()); $.post("/admin/ReorderNews", da
$('#example').tableDnD({
onDrop: function (table, row) {
alert(JSON.stringify($('#example').tableDnDSerialize()));
var data = JSON.stringify($('#example').tableDnDSerialize());
$.post("/admin/ReorderNews", data, function (theResponse) {
$("#response").html(theResponse);
});
},
dragHandle: ".dragHandle"
});
以下是示例数据:example[]=&example[]=1&example[]=2&example[]=
当我将数据发布到/admin/ReorderNews/
详情如下:
[HttpPost]
public ActionResult ReorderNews(string data)
{
return Content("ok");
}
它返回正常。然而,当我调试时,我看到数据是null
如何修复此问题?在post方法中尝试将数据作为{“data”:data},并在actionresult中使用字符串数据
$.post("/admin/ReorderNews", {"data":data}, function (theResponse) {
$("#response").html(theResponse);
});
谢谢我想问题是,它不是一种
字符串
。我怎样才能把它串起来?