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

  • 相关阅读:
    pureftpd无法上传、新建、覆盖文件的解决方法
    nginx 安装
    Generating Artifacts问题解决汇总
    Java Project和Web Project 区别
    CString 截取字符串全攻略
    截取字符串--sql和access的区别
    VC++线程函数内怎么调用外部函数
    CTime与CString相互转化
    CString的所有函数
    深层次的理解_variant_t
  • 原文地址:https://www.cnblogs.com/zying3/p/11097854.html
Copyright © 2020-2023  润新知