- function formSubmit(){
- if (form.getForm().isValid()) { //验证表单填写的数据是否有效
- form.getForm().submit({ //调用basicForm的submit方法
- waitTitle : '提示',//标题
- waitMsg : '正在提交数据请稍后...',//提示信息
- url : 'eidtBooktype.action', //将要把表单发送到哪里
- method : 'post', //指定发送方式
- params : 'booktype', //携带的参数
- success : function(form, action){ //form指这个表单 action指返回内容
- var flag=action.result.msg;
- window.returnValue='SUCC';
- Ext.Msg.alert('提示',flag,function(){
- window.close();
- });
- },
- failure : function(form,action) {
- var flag=action.result.msg;
- Ext.Msg.alert('操作', flag);
- }
- });
- }
- }
- <PRE class=Ext.Ajax.request name="code">Ext.Ajax.request({
- url : 'deleteBooktypes.action',
- method : 'post',
- params : {delids:deleteids.toString()},
- success : function(form,action) {
- var respText = Ext.util.JSON.decode(form.responseText); //把字符串变为json格式
- var msg=respText.msg; //获取里面的值的方法与上面稍有不同
- Ext.MessageBox.alert('提示',msg,function(){
- bookTypeStore.reload();
- });
- },
- failure : function(response,options) {
- var respText = Ext.util.JSON.decode(response.responseText); //吧字符串变为json格式
- var msg=respText.msg;
- Ext.MessageBox.alert('提示',msg,function(){
- bookTypeStore.reload();
- });
- }
- });
- </PRE>
- <P style="FONT-FAMILY: Simsun; WHITE-SPACE: normal; FONT-SIZE: medium"> </P>
最明显就是success和failure时候function的参数
Ext.Ajax.request的function(response,options),option非常有用,用response.responseText获得返回参数,注意这个地方的response参数可以换成action
form.getForm().submit的function(form, action),action很有用,用action.result.msg获得返回值
还有个最明显区别是Ext.Ajax.request不可以用waitMsg