zoukankan      html  css  js  c++  java
  • 关于layer.alert()函数不调用

    代码:

    var ms = $("input[name='mstj']:checked").val();

    if(ms === '1'){

      layer.alert('请确认您为免试!');

    }

    layer.confirm(
      '您确定要保存当前信息吗?',
      {title:['系统消息','background:#e4f4eb;color:#238651;'], btn: ['确定', '取消'],icon: 3},
      function(index){
        $('#form1').ajaxSubmit({

          type:'post',
          dataType:'json',
          url:'student_util.jsp',
          timeout: 20000,
          success:function(data){
            if(data.state=='1'){
              layer.msg('操作成功!',{icon: 6});
              setTimeout('window.location.href="apply_util.jsp"',1000);//setTimeout是js附带的延缓执行函数
            }else{
              layer.msg('操作失败!',{icon: 5});
            }
          },error:function(req, textStatus, errorThrown){
          alert('操作出现异常,请稍后再试!');
        }
      });
    });

    解决方法

    var ms = $("input[name='mstj']:checked").val();
    if(ms === '1'){
      layer.alert('请确认您为免试!', function(index){
        layer.confirm(
        '您确定要保存当前信息吗?',
        {title:['系统消息','background:#e4f4eb;color:#238651;'], btn: ['确定', '取消'],icon: 3},
          function(index){
            $("#uploadFile").remove();
            checkSubmitFlg = true;
            $('#form1').ajaxSubmit({
              type:'post',
              dataType:'json',
              url:'student_util.jsp',
              timeout: 20000,
              success:function(data){
                if(data.state=='1'){
                layer.msg('操作成功!',{icon: 6});
                setTimeout('window.location.href="apply_util.jsp"',1000);//setTimeout是js附带的延缓执行函数
              }else{
                layer.msg('操作失败!',{icon: 5});
              }
            },error:function(req, textStatus, errorThrown){
              alert('操作出现异常,请稍后再试!');
          }
        });
       });
      });
    }

    原因:

      layui的所有组件都是非阻断式的,所以处理的话一般都在msg的end关闭消息后去处理跳转

  • 相关阅读:
    Vue学习Day05-Vue中组件间的通讯(父到子,子到父,兄弟间)
    mysql数据库阻塞事务分析(thread_running突然升高)
    新建npm的nexus本地仓库,npm install报错npm ERR! code E401
    sqlserver数据库可以ping通但是1433端口无法telnet
    ansible使用synchronize模块报Broken pipe
    centos7上vagrant的安装及使用
    centos无法安装后无法识别r6818网卡问题
    手动上传snapshot和第三方jar包到nexus3
    搭建docker私有仓库nexus
    python3的pip安装报错pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
  • 原文地址:https://www.cnblogs.com/zying3/p/11097854.html
Copyright © 2011-2022 走看看