zxf_noimp 发表于 2013-1-23 02:08:45

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;}
页: [1]
查看完整版本: ExtJs中的Ajax