ExtJS中submit與Ajax的success
Ext.Ajax.request({
url: path + '/settle/qualityInfoAction.action', //配置Action請求
params: {
qualityAssayId : _quality //配置傳到後臺的引數
},
success: function(response){ //success中用response接受後臺的資料
_json = Ext.util.JSON.decode(response.responseText) ; //將Json資料進行反編碼成Object
_root = Ext.util.JSON.encode(_json.page.root) ; //將物件object編譯成Json串
_root = _root.replace('[','') ;
_root = _root.replace(']','')
_rootInfo = Ext.util.JSON.decode(_root) ;
Ext.getCmp('ngymt').setValue(_rootInfo.ngymt) ;//全水分
Ext.getCmp('nlcfad').setValue(_rootInfo.nlcfad) ;//灰分
Ext.getCmp('nlcfvd').setValue(_rootInfo.nlcfvd) ;//揮發分
Ext.getCmp('nlcfstd').setValue(_rootInfo.nlcfstd) ;//硫分
Ext.getCmp('nqnetarkc').setValue(_rootInfo.nqnetarkc) ;//發熱量
},
failure: function(){
Ext.Msg.show({
title: '錯誤提示',
msg: '訪問資料庫時發生錯誤!',
buttons: Ext.Msg.OK,
icon: Ext.Msg.ERROR
});
}
});
FormPanel中Submit的Success使用action接收後臺傳來的Json
settleDetailForm.getForm().submit({ //獲取basicform
url: path + '/settle/delete4saveSettleInfo.action', //設定Action請求
waitTitle: '請稍候',
waitMsg: '正在提交表單資料,請稍候...',
success: function(form, action){ //succes中用action接收後臺傳來的Json資料,使用action.result獲得Json Object
myExt.Msg.show({
title: '成功提示',
msg: '操作成功!',
buttons: myExt.Msg.OK,
icon: myExt.Msg.INFO,
fn: function(){
//獲取ds_settle
ds_settle.removeAll() ;
ds_settle.proxy = new Ext.data.HttpProxy({ url : path+'/settle/findSettleByCode.action?settleSerialno='+action.result.settleSerialno , method:'POST'});
ds_settle.reload({
callback:function(){
settleDetailForm.getForm().loadRecord(ds_settle.getAt(0));
}
}) ;
}
});
},
failure: function(form, action){
myExt.Msg.show({
title: '錯誤提示',
msg: '操作失敗,請重新操作!',
buttons: myExt.Msg.OK,
icon: myExt.Msg.ERROR,
fn: function(){
}
});
}
});