AjaxでリストオブジェクトをControllerに渡す
AjaxでリストオブジェクトをControllerに渡す
JS
var things = [ { id: 1, color: 'yellow' }, { id: 2, color: 'blue' }, { id: 3, color: 'red' } ]; $.post('@Url.Action("PassThings")', { things: things }, function () { $('#result').html('"PassThings()" successfully called.'); });
Controller
[HttpPost] public void PassThings(IEnumerable<Thing> things) { // do stuff with things here... }