`

ExtJs中的Ajax

阅读更多
Ext.Ajax.request({
				url : '../score/ratingscore.do?act=updateScore',
				params : {
					id : e.get("id"),   //要传的参数
					content : e.get("score")
				},
				success : function(response, options) {
					var result = Ext.util.JSON.decode(response.responseText);  //定义返回值
					Ext.Msg.show("返回值",result.message);   //message为后台返回值的名称
				},
				failure : function() {
					Ext.Msg.show({
						title : '错误提示',
						msg : '修改数据发生错误,操作将被回滚!',
						buttons : Ext.Msg.OK,
						icon : Ext.Msg.ERROR
					});
				}
			});
 
@RequestMapping(params = "method=updateScore")
public ModelAndView updateScore(Student stu, HttpServletResponse reponse)
		throws Exception {
	int count = dataZxZdbnrService.insertStudent(stu);
	String result = "";
	if (count > 0) {
		count = dataZxZdbnrService.findByLast();
		result = "{message:"+count+",success:true}";
	}
	reponse.getWriter().write(result);
	return null;
}
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics