2
我想要做的是将一个字符串/整数数组传递给mvc操作方法。 但数据总是返回为空,我做错了什么?JQuery发布数据到MVC操作方法?
MVC控制器
[HttpPost]
public ActionResult MyAction(List<string> ids)
{
// do something with array
// But it's null
return View();
}
JQuery的
$.post("/MyController/MyAction", JSON.stringify(ids), function() { alert("woohoo"); }, "application/json");
数据被派驻到行动结果
["156"]
我已经尝试过了,仍然会返回为空{“ids”:[“156”]} – aryaxt 2013-03-26 21:12:03
对不起,您还必须指定内容类型。更新答案。 – 2013-03-26 21:28:01
我已经在我的代码中,我开始并行(虚拟机),现在一切正常。太ba我不能删除问题 – aryaxt 2013-03-26 21:44:44