jquery ajaxSubmit 异步提交的简单实现
前台js
代码如下:
$("#nickForm").ajaxSubmit({ type: "post", url: "http://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(); }
相关推荐
81751330 2015-03-10
wuxhyou 2015-04-11
adgjlxxx 2016-12-23
RanQi0 2016-04-21
wcqwcq 2016-12-23
sunnyishere 2015-12-21
jiaojiao0 2015-03-10
levysnail 2014-12-10
roodyszz0 2014-03-06
congweijing 2014-03-05
longshengguoji 2014-02-26
congweijing 2013-01-24
欧阳凯少 2012-11-16
AJAXBloger 2012-09-02
sunnyishere 2012-05-29
WillZhang 2011-10-24
zhuchengzzcc 2011-09-08
chongxiaocheng 2011-07-28