possible duplicate Passing A List Of Objects Into An MVC Controller Method Using jQuery Ajax
but my question is when I pass
var things = [
  {employee:'test',effectiveDate:'',expirationDate:'' },
  { employee:'test',effectiveDate:'',expirationDate:'' }
];
$.ajax({
 contentType: 'application/json',
 type: "POST",
 url: "/MyController/CheckMethod",
 dataType: "json",
 data: JSON.stringify(things),
 async: false,
 success: function (data) {
to an controller method which is a [HTTPPOPST] JsonResult then I'm getting value into my List<MYMODEL>
but when I take a controller method as 'ActionResult' then i'm getting null in List<MYMODEL>
why so any thing wrong?
I think first of all your JSON should be strongly typed. and once it already strongly typed you need not use JSON.stringfy. instead go with,
data: {"things" : things},
and your controller should be like
public IActionResult ActionName(List<Model> things)
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With