How do I pass this js array to my MVC 3 controller?

前端 未结 7 2102
粉色の甜心
粉色の甜心 2020-12-31 16:58

I am getting null values in the controller. Not sure what am I am missing.

I have a grid where I have a list of guests (with name & email) where user select gues

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-31 17:35

    $.ajax({
                type: "POST",
                url: "yourUrl",
                data: JSON.stringify(yourArray),
                contentType: "application/json; charset=utf-8"
            });
    

    contentType: "application/json; charset=utf-8" - is very important part

    [HttpPost]
    public void Fake(List yourArray)
    {
    }
    

提交回复
热议问题