dongtangxi1584 2017-11-26 20:41
浏览 70
已采纳

使用脚本的甜警报成功按钮错误

I've been trying to use this script called "Sweet alert" in my form because I want my site with a nice look. The thing is that when I want to login, my document called validar.php recognize user and password normally but it doesn't redirect to other page.

I've already added these "Sweet alert" libreries at the beggining of my program.

 if($f3=mysqli_fetch_assoc($sql3))
    {
        if($pass==$f2['contraAdmin'] && $administrador==$f3['tipoUsuario'])
        {
        echo "<script>
            swal({  
                title: 'Acceso',
                text: '¡Bienvenido Administrador!',  
                type: 'success',    
                confirmButtonText: 'Aceptar', 
                showLoaderOnConfirm: true, }, 
                    function(){      
                        location.href = 'RegistroEmp.php';  

                 });
            </script>";


        }

Therefore, when I use an script alert it works perfectly.

 echo '<script>alert("Welcome Admin")</script> ';

            echo "<script>location.href='RegistroEmp.php'</script>";

Thanks. I hope you can help me. Regards!

  • 写回答

1条回答 默认 最新

  • dongtan9253 2017-11-26 20:47
    关注

    This can be useful

    swal({
      title: 'Acceso',
      text: "¡Bienvenido Administrador!",
      type: 'success',
      showCancelButton: true,
      confirmButtonText: 'Aceptar'
    }).then(function(){
        location.href='RegistroEmp.php'
    })
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line