Post a json object to mvc controller with jquery and ajax

后端 未结 3 1225
傲寒
傲寒 2020-12-18 17:57

I am trying to submit some values from a form to my mvc controller.

Here is my controller:

 //Post/ Roles/AddUser
    [HttpPost]       
    public Ac         


        
3条回答
  •  别那么骄傲
    2020-12-18 18:47

    I see in your code that you are trying to pass an ARRAY to POST action. In that case follow below working code -

    
    
    
    
    

    And the controller action is going to be -

        public ActionResult AddUser(List Roles)
        {
            return null;
        }
    

    Then when you click on the button -

    enter image description here

提交回复
热议问题