Javascript数组到viewmodel字符串数组

时间:2014-12-12 12:42:51

标签: jquery asp.net-mvc asp.net-mvc-viewmodel

当在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)
{
   ...
}

0 个答案:

没有答案