jquery Ajax call - data parameters are not being passed to MVC Controller action

后端 未结 5 1466
粉色の甜心
粉色の甜心 2020-12-08 02:31

I\'m passing two string parameters from a jQuery ajax call to an MVC controller method, expecting a json response back. I can see that the parameters are populated on the cl

5条回答
  •  粉色の甜心
    2020-12-08 02:58

    I tried:

    
    
    
    

    and C#:

    [HttpPost]
    public ActionResult Test(string ListID, string ItemName)
    {
        return Content(ListID + " " + ItemName);
    }
    

    It worked. Remove contentType and set data without double quotes.

提交回复
热议问题