I am having a simple issue which is taking way to long to figure out. I cant seem to get data from JS into MVC.
JS:
var stuff = [{a: 1, b: "Low"}, {a: 5, b:"High"}];
$.ajax({
url: '@Url.Action("Action")',
type: 'POST',
data: JSON.stringify({ stuff: stuff }),
traditional: true
});
MVC
public enum Level
{
High = 10,
Normal = 5,
Low = 1
}
...
public class MyModel
{
public int a { get; set; }
public Level b { get; set; }
}
...
public ActionResult Action(List<MyModel> stuff){
//stuff is always null no matte what I try?
....
}
I am not sure where my problem actually is, as this is surprisingly hard to debug.