EXT请求总结

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("提示", "提交失败!");
					},

后台:void 函数

try {
			response.setCharacterEncoding("UTF-8");
			response.setContentType("text/html");
			response.getWriter().write("{success:" + result + ",msg:'"+ msg +"'}");
	    } catch (Exception e) {
	    	e.printStackTrace();  
	    } 

2、submit:注意不要加fileUpload : true,

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<String, Object>函数

map.put("success", true);
return map;

你可能感兴趣的:(ext)