ASP.NET Core 2, jQuery POST data null

后端 未结 3 619
挽巷
挽巷 2021-02-13 15:24

I use jQuery and send data with the POST method. But in the server method the values are not coming. What could be the error?

client

3条回答
  •  再見小時候
    2021-02-13 16:02

    Use [FromBody] before the param. It's check and Get the Property value in body otherwise it's check the Url Querystring.

    Example:

    [HttpPost]
    public JObject AddTag([FromBody] int parentid,[FromBody]string tagname)
    {
    
    }
    
    [HttpPost]
    public JObject AddTag([FromBody] {ModelName} parent)
    {
    
    }
    

提交回复
热议问题