How can I return a JSON result to a Ajax.BeginForm

后端 未结 6 1155
独厮守ぢ
独厮守ぢ 2021-02-02 08:49

I have got this simple form:

@using (Ajax.BeginForm(\"CreateProductFromAjaxForm\",\"Product\" , 
                  null, 
                  new AjaxOptions() {           


        
6条回答
  •  礼貌的吻别
    2021-02-02 09:32

    Try specifying the HTTP method:

    new AjaxOptions() {  
        OnSuccess = "getresult", 
        HttpMethod = "post" 
    }
    

    Example:

    @using (Ajax.BeginForm("CreateProductFromAjaxForm", "Product" , null, new AjaxOptions() {  OnSuccess = "getresult", HttpMethod = "post" }, null))
    {
        ....
    }
    

提交回复
热议问题