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

时间:2017-11-26 20:41:36

标签: javascript php

我一直在尝试使用这个名为" Sweet alert"在我的形式,因为我希望我的网站看起来很漂亮。 问题是,当我想登录时,我的文件名为validar.php正常识别用户和密码,但它没有重定向到其他页面。

我已经添加了这些" Sweet alert"在我的计划开始时的libreries。

 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>";


        }

因此,当我使用脚本警报时,它可以完美地运行。

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

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

感谢。 我希望你能帮助我。 问候!

1 个答案:

答案 0 :(得分:1)

这很有用

swal({
  title: 'Acceso',
  text: "¡Bienvenido Administrador!",
  type: 'success',
  showCancelButton: true,
  confirmButtonText: 'Aceptar'
}).then(function(){
    location.href='RegistroEmp.php'
})
相关问题