I have a simple form to login for users with login and password ... I'm not able to give submit via JQuery, look at the code:
<div id="opcoes2">
<div id="fazerlogin2">
<form name="fazerloginform" id="fazerloginform" action="fazerloginform.php" method="post">
<input id="login" type="text" name="login" value="Login ou email">
<input id="senha" type="password" name="senha" value="Senha">
<span id="esqueceusenha">Esqueceu a senha ?</span>
<input id="entrar" type="submit" value="ENTRAR">
<div id="loginresposta"></div>
</form>
</div>
<script>
$(document).ready(function() {
$("#fazerloginform").submit(function() {
var login = $("#login").val();
var senha = $("#senha").val();
$("#entrar").prop('disabled', true);
$("#loginresposta").html("Logando...");
$.post('fazerloginform.php', {
login: login,
senha: senha
}, function(resposta) {
if (resposta != false) {
$("#fazerloginform").submit();
} else {
$("#loginresposta").html("Login ou senha incorretos.");
$("#entrar").prop('disabled', false);
}
}, 'html');
return false;
});
})
</script>
I'm using jquery version 2.1.1.js, is this it? The error is that it is "Logging ..." and for the script, do not give the submit !!!
I also wanted to know the best way to login in php and mysql with jquery?