我有以下jQuery代码传递的值的阵列,如何打通.getJSON方法在控制器方法的参数
var ids = []
var id ={"Param1": 1, "Param2": 2, "Param3": 3}
ids.push(id)
var id ={"Param1": 3, "Param2": 2, "Param3": 6}
ids.push(id)
$.getJSON("/Controller/Action1",
{
str: ids
}
, function (data) {
});
public JsonResult Action1(string[] str)
{
return Json("Success", JsonRequestBehavior.AllowGet);
}
我知道字符串数组是不正确的。什么是正确的参数类型来获取从jQuery传递的集合。
在此先感谢!
我试过列表,但值为空。没有运气。 –
user472269