Dan*_*iel 37

$.ajax({
          url: <Url of the action>,
          type: "POST",
          data: JSON.stringify([1,2,3]),
          dataType: "json",
          contentType: 'application/json; charset=utf-8'
});
Run Code Online (Sandbox Code Playgroud)

并在行动中.

public ActionResult ReceiveIntArray(int[] ints)
{
   ...
}
Run Code Online (Sandbox Code Playgroud)

mvc应该自动解析json.

看看这个问题.

  • 不要为我工作 - 我仍然无效. (4认同)
  • 抱歉,您必须使用JSON.stringify([1,2,3])我编辑了答案 (3认同)
  • 无法从我的代码中工作...无法找到原因。当我输入方法参数为空时。 (2认同)