My controller:
[HttpPost]
public ActionResult AddUsers(int projectId, int[] useraccountIds)
{
...
}
I\'d like to post the parameters to
In JS:
var myArray = new Array();
myArray.push(2);
myArray.push(3);
$.ajax({
type: "POST",
url: '/MyController/MyAction',
data: { 'myArray': myArray.join() },
success: refreshPage
});
In MVC/ C#:
public PartialViewResult MyAction(string myArray)
{
var myArrayInt = myArray.Split(',').Select(x=>Int32.Parse(x)).ToArray();
//My Action Code Here
}