jquery ajaxSubmit 异步提交的简单实现
程序员文章站
2023-08-26 11:08:32
jquery ajaxsubmit 异步提交的简单实现代码如下:
$("#nickform").ajaxsubmit({
&nb...
jquery ajaxsubmit 异步提交的简单实现代码如下:
$("#nickform").ajaxsubmit({
type: "post",
url: "https://localhost:8080/test/myspace.do?method=updatenick¶m=1",
datatype: "json",
success: function(result){
//返回提示信息
alert(result.nickmsg);
}
});
后台封装:
. 代码如下:
public actionforward toupdatenickname(actionmapping mapping, actionform form,
httpservletrequest request, httpservletresponse response){
printwriter pw = response.getwriter();
jsonobject obj = new jsonobject();
obj.put("nickmsg", "昵称修改成功!");
pw.print(obj);
pw.close();