当在ViewModel上作为字符串数组发回到控制器操作时,尝试获取在javascript中创建的数组,但它不起作用...
var action = '/Controller/Action';
var array = ['item1', 'item2', ...];
var data = { ArrayName: array };
$.post(action, data, function (result) {
...
}
public class ArrayViewModel
{
public string[] ArrayName{ get; set; }
}
public ActionResult Action(ArrayViewModel arrayViewModel)
{
...
}