• Ext数据提交


    1, EXT的form表单ajax提交(默认提交方式)

    function login(item) {
               
                 if (validatorForm()) {
                     // 登录时将登录按钮设为disabled,防止重复提交
                     this.disabled = true;
     
                     // 第一个参数可以为submit和load
                     formPanl.form.doAction('submit', {
     
                          url : 'user.do?method=login',
      
                          method : 'post',
      
                          // 如果有表单以外的其它参数,可以加在这里。我这里暂时为空,也可以将下面这句省略
                              params : '',
      
                              // 第一个参数是传入该表单,第二个是Ext.form.Action对象用来取得服务器端传过来的json数据
                              success : function(form, action) {
      
                                  Ext.Msg.alert('操作', action.result.data);
                                  this.disabled = false;
      
                              },
                              failure : function(form, action) {
      
                                  Ext.Msg.alert('警告', '用户名或密码错误!');
                                  // 登录失败,将提交按钮重新设为可操作
                                  this.disabled = false;
      
                              }
                          });
                      this.disabled = false;
                  }
              }

    2.EXT表单的非ajax提交

     //实现非AJAX提交表单一定要加下面的两行!
     onSubmit : Ext.emptyFn, submit : function() {    
     //再次设定action的地址    
     this.getEl().dom.action ='user.do?method=login'; this.getEl().dom.method = 'post';    
     //提交submit    
      this.getEl().dom.submit();    
     }, 

    3.EXT的ajax提交

    Ext.Ajax.request({
                                           //请求地址
                         url: 'login.do',
                         //提交参数组
                         params: {
                             LoginName:Ext.get('LoginName').dom.value,
                             LoginPassword:Ext.get('LoginPassword').dom.value
                          },
                          //成功时回调
                          success: function(response, options) {
                            //获取响应的json字符串
                            var responseArray = Ext.util.JSON.decode(response.responseText);                                              
                                if(responseArray.success==true){
                                    Ext.Msg.alert('恭喜','您已成功登录!');    
                                }
                                else{
                                    Ext.Msg.alert('失败','登录失败,请重新登录');    
                                }
                        }
                });



  • 相关阅读:
    线段树----hdoj 1754 I here it
    树状数组----poj 2352 stars
    莫队算法
    枚举+深搜----poj 3279 Fliptile
    java 10 -09的作业
    java 09 06 thread-同步代码块-同步方法
    java09-05 join_daemon
    java09 02 Thread-yield 放弃
    java 07 jar
    java 08 作业
  • 原文地址:https://www.cnblogs.com/lizhao/p/1990480.html
Copyright © 2020-2023  润新知