How to submit spring form in ajax(jquery) with modelAttribute

前端 未结 2 1371
不知归路
不知归路 2021-02-01 08:20

I am new to Spring MVC. I have a form like this,

and a co

2条回答
  •  失恋的感觉
    2021-02-01 08:50

    You need to post the data. The way I typically do it is using the following.

    var str = $("#myForm").serialize();
    
    $.ajax({
        type:"post",
        data:str,
        url:"/myaction.htm",
        async: false,
        dataType: "json",
        success: function(){
           alert("success");
        }
    });
    

提交回复
热议问题