Passing A List Of Objects Into An MVC Controller Method Using jQuery Ajax

前端 未结 13 1733
逝去的感伤
逝去的感伤 2020-11-22 14:22

I\'m trying to pass an array of objects into an MVC controller method using jQuery\'s ajax() function. When I get into the PassThing() C# controller method, the argument \"t

13条回答
  •  春和景丽
    2020-11-22 14:35

    If you are using ASP.NET Web API then you should just pass data: JSON.stringify(things).

    And your controller should look something like this:

    public class PassThingsController : ApiController
    {
        public HttpResponseMessage Post(List things)
        {
            // code
        }
    }
    

提交回复
热议问题