Ext.Ajax.request 与FormPanel.form.submit

ExpandedBlockStart.gif 代码
Ext.Ajax.request({   
                        url : 
' url ' ,   
                        params : {   
                            ID : record.data.ID   
                        },   
                        success : 
function (response, options) {   
                            
var  txt = Ext.util.JSON.decode(response.responseText);    
                               
                            
if (txt.success)   
                            {   
                                Ext.Msg.show({   
                                    title : 
' 成功提示 ' ,   
                                    msg : 
' 删除成功! ' ,   
                                    buttons : Ext.Msg.OK,   
                                    icon: Ext.MessageBox.INFO   
                                });   
                                Project_grid.getStore().remove(record);   
                            }   
                            
else   
                            {   
                                Ext.Msg.show({   
                                    title : 
' 错误提示 ' ,   
                                    msg : txt.msg,   
                                    buttons : Ext.Msg.OK,   
                                    icon : Ext.Msg.ERROR   
                                });   
                            }   
                        },   
                        failure : 
function () {   
                            Ext.Msg.show({   
                                title : 
' 错误提示 ' ,   
                                msg : 
' 删除时发生错误! ' ,   
                                buttons : Ext.Msg.OK,   
                                icon : Ext.Msg.ERROR   
                            });   
                        }   
                    });  

Ext.Ajax.request({
                        url : 
' url ' ,
                        params : {
                            ID : record.data.ID
                        },
                        success : 
function (response, options) {
                            
var  txt = Ext.util.JSON.decode(response.responseText); 
                            
                            
if (txt.success)
                            {
                                Ext.Msg.show({
                                    title : 
' 成功提示 ' ,
                                    msg : 
' 删除成功! ' ,
                                    buttons : Ext.Msg.OK,
                                    icon: Ext.MessageBox.INFO
                                });
                                Project_grid.getStore().remove(record);
                            }
                            
else
                            {
                                Ext.Msg.show({
                                    title : 
' 错误提示 ' ,
                                    msg : txt.msg,
                                    buttons : Ext.Msg.OK,
                                    icon : Ext.Msg.ERROR
                                });
                            }
                        },
                        failure : 
function () {
                            Ext.Msg.show({
                                title : 
' 错误提示 ' ,
                                msg : 
' 删除时发生错误! ' ,
                                buttons : Ext.Msg.OK,
                                icon : Ext.Msg.ERROR
                            });
                        }
                    }); 

2 、关于 Ext.FormPanel

    可以通过FormPanel.form.submit来提交到服务器,然后再通过传回来的值来处理接下来的工作。

Js代码 
form.submit   
// 提交到服务器   
                            PformPanel.form.submit   
                            (   
                                {   
                                    url:url,  
// 提交的页面路径   
                                    method: ' post ' , // 提交方式为post   
                                     // 提交成功的回调函数   
                                    success: function (form,action)   
                                    {   
                                        
var  flage  =  action.result.success;   
                                        
// 如果服务器端传过来的数据为true则表示添加成功   
                                         if  (flage  ==   true )   
                                        {   
                                            Ext.MessageBox.alert(
' 恭喜 ' , ' 添加添加成功! ' );   
                                            newWin.hide();   
                                        }   
                                    },   
                                    
// 提交失败的回调函数   
                                    failure: function ()   
                                    {   
                                        Ext.Msg.alert(
' 错误 ' , ' 服务器出现错误请稍后再试! ' );   
                                    }   
                                }   
                            );  

 

转载于:https://www.cnblogs.com/zqmingok/archive/2010/04/06/1705028.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值