ExtJS中Ext.Ajax.request与form.getForm().submit()返回值获取

 1. Ext.Ajax.request

Ext.Ajax.request({
                           url: '../xxx',
                           method:"POST",
                           params: {paramName: paramValue},
                           success: function(resp,opts){
                               //返回的对象Ext.util.JSON.decode(request.responseText)
                               var respText = Ext.util.JSON.decode(resp.responseText);
                               var msg= respText.msg;
		Ext.MessageBox.alert('提示', msg);
                           },
                           failure: function(resp,opts){
		//返回的对象Ext.util.JSON.decode(request.responseText)
                               var respText = Ext.util.JSON.decode(resp.responseText);
                               var msg= respText.msg;
		Ext.MessageBox.alert('提示', msg);
	           }                           
                       });

2. form.getForm().submit()

this.formPanel.getForm().submit({
                                    waitTitle: "请稍候",
                                    waitMsg : '提交数据,请稍候...',
                                    success: function() {	                                    
                                        myDialog.hide();
                                        store.reload();
                                    },
                                    failure: function(form, action) {                                        
                                        Ext.MessageBox.alert('提示', action.result.msg);
                                        return;
                                    },
                                    scope: this                                 
                                });

相关推荐