Apparently I am doing something wrong, Tried everything.
Initially I needed to send array of objects to asp.net mvc controller using angular's $http, well it didn't work.
Then I tried to use jquery. I've tried $.get, $.post, $.ajax methods with different parameters (traditional, non-traditional, with dataType:'json', without it - still can't pass the values. This thing is killing me.
$.ajax(
url: '/Home/Foo'
data: items: [{'name':'some'},{'name':'other'}])
public JsonResult Foo(Item[] items)
{
return Json(items, JsonRequestBehavior.AllowGet);
}
public class Item
{
public string name { get; set; }
}
The best what I could get out of it - it recognizes items as Item[] array but every name value is null
data: items: [{'name':'some'},{'name':'other'}]is incorrect JSON syntax. Trydata: { 'items' : [{'name':'some'},{'name':'other'}]}instead.