zoukankan      html  css  js  c++  java
  • 苹果微信浏览器不能post方式提交数据问题

    form表单中采用post方式提交数据时,在苹果的微信浏览器中无法传递,安卓的可以

    如图:

    在controller中获取该数据为 null 

    将表单的提交方式修改为get就能够获取到

    现在采用Ajax方式进行提交,类似于

     <div class="main">
          <form id="loginform">
          <input type="hidden" id="forward" value="${forward}"></input>
            <div class="item">
              <input class="txt-input txt-username" type="text" placeholder="请输入用户名/手机号" id="custid" name="username">
              </div>
            <div class="item">
              <input  type="password" placeholder="请输入密码"  class="txt-input txt-password ciphertext" id="password" name="password" style="display: inline;">
              <input type="text" placeholder="请输入密码" class="txt-input txt-password plaintext"   style="display: none;" name="ptext">
              <b class="tp-btn btn-off"></b> 
            </div>
            <input type="button" class="button" value="登录" onclick="login()" id="btnlogin">
    
          </form>
        </div>

     aJax提交form表单

        function login() {
            if (!$('#custid').val()) {
                $('#custid').focus();
                $("#custid").testRemind("用户名不能为空!"); 
                return false;
            }
            
            if (!$('#password').val()) {
                $('#password').focus();
                $("#password").testRemind("密码不能为空!");
                return false;
            }
            $("#btnlogin").val("正在登录中");
            var pswd = $('#password').val();
            $('#password').val($.des.getDes(pswd)).hide();
            $("#btnlogin").attr("disabled", "disabled");
            $("#loginform input").addClass("readonly").attr("readonly", "readonly");
            $.ajax({
                  type:"post" ,
                  data: {
                      username:$('#custid').val(),
                      password:$('#password').val()
                  },
                  dataType : "json",
                  url: "${current_url}newlogin.action",
                  success: function(data){
                      $("#btnlogin").attr("disabled", false);
                        $("#loginform input").removeClass("readonly").attr("readonly", false);
                          if(data.result=="1"){
                              window.location.href = data;
                  
                      }else{
                          if(data.message == '账户已锁定请联系管理员解锁'){
                                jAlert("您的账户已被锁定,请联系客服解锁!",'提示');
                            }else{
                                
                                jAlert(data.message,'提示',function(r){
                                    $("#password").val(pswd).show();
                                });
                            }
                          $("#btnlogin").val("登录");
                          $('#custid').val("");
                          $('#password').val("");
                          return false;
                      }
                  },
                  error : function(data){
                      jAlert('系统繁忙,请稍后!','提示',function(r){
                          $("#btnlogin").val("登录");
                          $('#custid').val("");
                          $('#password').val("");
                          return false;
                      });
                      
                  }
              });
        }
                /*ajax start*/
              /* $.ajax({
                url:"${pathWeb}/user/tgRecharge.do",
                type:"post",
                data:{pay_money:pay_money},
                success:function(){
                    alert(data); 
                },
                error:function(e){
                    alert("错误!!");
                    window.clearInterval(timer);
                }
            });     */
            /*ajax end*/
  • 相关阅读:
    初涉数组
    声明
    简述java程序中的main方法
    概述java语言
    1.3 linux基础(三)
    linux基础之-screen命令
    1.2 linux基础(二)
    1.1 Linux基础(一)
    实验7-1-13 装箱问题
    实验7-1-12 组个最小数
  • 原文地址:https://www.cnblogs.com/taiguyiba/p/6763805.html
Copyright © 2011-2022 走看看