当前位置: 代码迷 >> Ajax >> Ext formpanel submit 交付与ext.ajax.request提交的区别
  详细解决方案

Ext formpanel submit 交付与ext.ajax.request提交的区别

热度:961   发布时间:2012-11-01 11:11:32.0
Ext formpanel submit 提交与ext.ajax.request提交的区别
转http://wjt276.iteye.com/blog/806466
http://wjt276.iteye.com/blog/806468
1. Ext.FormPanel
f.getForm().submit({  
   url:"......",  
   params:{   XX:xx .....}  
   success: function (c,v,e) {    //e: 触发事件  
                  var json=Ext.decode(v.response.responseText);  
               },  
   failure:function(c,v,e){}  
})  



2.Ajax ext.ajax.request

 Ext.Ajax.request({  
    url:"....",  
    params:{XX:xx....},  
    success: function (v,c) {  
                   var json=Ext.decode(v.responseText);  
                },  
    failure:function(v,c){}  
})  



FormPanel
var G = new Ext.form.FormPanel({})  
G.getForm().submit({//客户端的数据提交给服务器  
  url:wayfoon.MMS.DataPage +'/ext2Upload.action',  
   //waitMsg:"正在提交表单数据,请稍候。。。。。。",  
   failure:function(form, action){  
   Ext.MessageBox.alert('警告', action.result.errors);  
},   
success: function(form, action){   
Ext.MessageBox.alert('信息', action.result.msg);  
}   
});  



Ext.Ajax.request({  
url:wayfoon.MMS.DataPage+'/cpSMS.action?action=submitSMS',  
method:'POST',  
params:'id='+id,  
success:function(form,action){  
var obj = Ext.util.JSON.decode(form.responseText);  
if(obj.success==true)  
{   
Ext.Msg.alert('提示',obj.msg);  
ds.reload();  
}  
else  
{  
//Ext.Msg.alert('提示',obj.errors);  
Ext.Msg.alert('提示',obj.msg);  
}  
},  
failure:function(form,action){  
Ext.Msg.alert('警告','系统错误');  
}  
});  



  相关解决方案