这是我的演示,使用mvc2,希望有帮助〜
成功的关键是传统
将
traditional参数设置为true
$(function(){ var a = [1, 2]; $.ajax({ type: "POST", url: "<%= ResolveUrl("~/Home/PostArray/") %>", data: {orderedIds: a}, dataType: "json", traditional: true, success: function(msg){alert(msg)} });})从jquery 1.4开始,此参数存在是因为将对象序列化为查询参数的机制已更改。
行动是〜
[HttpPost]public ActionResult PostArray(int[] orderedIds){ return Content(orderedIds.Length.ToString());}


