I would like to know ho to iterate in asp.net mvc3 controller array passed by a jquery ajax call
My Ajax call:
var array = [];
array.push({ dir: id });
array.push({ dirToCreate: $("#txtDir").val() });
$.ajax({
Type: 'GET',
url: '/Home/CreateFolder/',
data: { 'list': array },
traditional: true,
cache: 'true',
success: function (result) {
alert(result);
}
});
And this is my ActionController:
public ActionResult CreateFolder (IEnumerable<string> list )
{
// how to iterate through the values passed
return Content("ok");
}
Actually, can I pass a array to ActionController like that as I am obtaining in the ActionController CreateFolder method object object ?
thanks