How do I pass a Dictionary as a parameter to an ActionResult method from jQuery/Ajax?

后端 未结 6 1528
无人共我
无人共我 2020-11-30 05:27

I\'m using jQuery to make an Ajax call using an Http Post in ASP.NET MVC. I would like to be able to pass a Dictionary of values.

The closest thing I could think of

6条回答
  •  天命终不由人
    2020-11-30 05:40

    It's possible with custom model binders or filters. Behind the scenes - you will have to do it manually anyway (Request.Form, parse strings, create dictionary tralala), but at least - your controller will be clean and code will be reusable for another actions.

提交回复
热议问题