zoukankan      html  css  js  c++  java
  • Ext.Ajax.request 与FormPanel.form.submit

    代码
    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(
    '错误','服务器出现错误请稍后再试!');   
                                        }   
                                    }   
                                );  
  • 相关阅读:
    javaScript控制按钮可用/不可用
    查询信息时对数据进行分页显示
    css样式-记录没记住的样式
    js里cookie,localStorage的简单用法
    关于BaseServlet的使用
    Web项目运行时tomcat服务器启动失败
    关于form表单提交数据后不跳转页面+ajax接收返回值的处理
    网页的标题栏添加小图标
    memcache安装过程
    Got minus one from a read call
  • 原文地址:https://www.cnblogs.com/zqmingok/p/1705028.html
Copyright © 2011-2022 走看看