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关闭消息后去处理跳转

  • 相关阅读:
    Spring AOP日志实现(一)
    ArrayList和LinkedList的区别
    webmagic保存数据
    Java静态代码块、构造代码块执行顺序问题
    为Spring Cloud Ribbon配置请求重试(Camden.SR2+)
    centos关机与重启命令
    解决win环境下访问本机虚拟机中centos7 ftp服务器的问题
    【MongoDB异常】Exception authenticating MongoCredential解决方法
    mongodb解决只能本地连接不能远程连接问题
    Windows Server 2008 R2提示api-ms-win-crt-runtime-l1-1-0.dll 丢失解决方法
  • 原文地址:https://www.cnblogs.com/zying3/p/11097854.html
Copyright © 2011-2022 走看看