1、submit请求(带附件)fileUpload : true,
success : function(a, b) { if (b.result) { Ext.Msg.alert("提示", "提交成功!", function() { window.close(); window.opener.reload(); }); } else { Ext.MessageBox.alert("提示", "提交失败!"); } }, failure : function(a, b) { Ext.MessageBox.alert("提示", "提交失败!"); },
try { response.setCharacterEncoding("UTF-8"); response.setContentType("text/html"); response.getWriter().write("{success:" + result + ",msg:'"+ msg +"'}"); } catch (Exception e) { e.printStackTrace(); }
success : function(a, b) { Ext.Msg.alert("提示", "已成功!", function() { window.close(); window.opener.reload(); }); }, failure : function(a, b) { Ext.MessageBox.alert("提示", b.result.msg); },
后台:Map<String, Object>函数
map.put("success", false);//true
map.put("msg", "。");
return map;
3、ajax
success : function(response, options) { var result = Ext.util.JSON.decode(response.responseText); if(result.success){ Ext.Msg.alert("提示", "成功!", function() { window.close(); window.opener.reload(); }); }else{ Ext.Msg.alert('提示', '失败。'); } }, failure:function(){ Ext.Msg.alert('提示', '失败。'); },
map.put("success", true);
return map;