Simple implementation of asynchronous submit in jquery ajaxSubmit
- 2020-03-30 02:08:01
- OfStack
The front desk js
$("#nickForm").ajaxSubmit({
type: "post",
url: "http://localhost:8080/test/myspace.do?method=updateNick¶m=1",
dataType: "json",
success: function(result){
//Returns a prompt & NBSP;
alert(result.nickMsg);
}
});
Background packaging:
public ActionForward toUpdateNickName(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
PrintWriter pw = response.getWriter();
JSONObject obj = new JSONObject();
obj.put("nickMsg", " Nickname modified successfully! ");
pw.print(obj);
pw.close();
}