Good afternoon, I'm having trouble running a JavaScript code inside PHP. My intention is for the user to miss the login and password to get a message on the login screen warning him that he missed, this using JavaScript causing him to remove a class called "invisible class".
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 not see where I'm going wrong. Would anyone guide me, any tips?
Thank you!