submit:返回的"success"字段为true,走success函数体,为false,走failure函数体
intfForm.getForm().submit({
success: function(form,action) {
Ext.MessageBox.alert("提示","返回的success字段为true");
},
failure: function(form,action) {
Ext.MessageBox.alert("提示","返回的success字段为false");
},
scope: this
});
Ajax:只要可以返回信息,也就是说只要程序没报错,就走success函数体,不论返回的"success"字段是true还是false,只是在success函数体里面进一步判断。如果后台出现异常了,导致Ajax请求并没能得到正常的返回,就走failure函数体
Ext.Ajax.request({
url : 'xxx',
params : {ids : aList},
success : function(resp) {
var respText = Ext.util.JSON.decode(resp.responseText);
Ext.MessageBox.alert('提示', "返回的数据正常");
if(respText.success) Ext.MessageBox.alert('提示', "返回的success字段为true");
else Ext.MessageBox.alert('提示', "返回的success字段为true");
},
failure : function(resp){
Ext.MessageBox.alert('提示', ""异常出现");
},
scope: this
});