0
Good afternoon, I’m having trouble running a Javascript code inside PHP. My intention is for the user to err the login and password appear a message on the Login screen warning the same that it erred, using Javascript making it remove a class called "class-invisible".
Follow the code below:
if ($resultado > 0) {
logaUsuario($usuario->id, $usuario->nome, $usuario->grupo);
header("Location: index.php");
} else {
echo "<script language='javascript' type='text/javascript'>
function mostrarErro() {
var alerta = $('.alerta-erro');
alerta.removeClass('classe-invisivel');
setTimeout(function() {
alerta.addClass('classe-invisivel');
}, 6000);
}
mostrarErro();
window.location.replace('login.php');
</script>";
}
I can’t see where I’m going wrong. Someone could guide me, some hint?
Thank you!
Thank you for the guidance that this is not good practice and for the help!
– Dennis Cezar