Daca schimb cu input type=submit imi apare pentru o secunda si dispare.
Dupa ce arata mesajul de succes vreau sa ma redirectioneze catre aceeasi pagina.
Cod: Selectaţi tot
<form class="account-form" id="submit_form" method="post">
<span id="error_message" class="text-danger"></span>
<span id="success_message" class="text-success"></span>
<fieldset>
<i class="ti-key"></i>
<input type="password" name="pass" id="pass" placeholder="Password" />
</fieldset>
<input type="button" value="Login" id="submit" class="red-bg" />
</form>
</div>
<script>
$(document).ready(function(){
$('#submit').click(function(){
var pass = $('#pass').val();
if( pass == '')
{
$('#error_message').html("All Fields are required");
}
else
{
$('#error_message').html('');
$.ajax({
url:"/unlock",
method:"POST",
data:{pass:pass},
success:function(data){
$("form").trigger("reset");
$('#success_message').fadeIn().html(data);
setTimeout(function(){
$('#success_message').fadeOut("Slow");
}, 5000);
}
});
}
});
});
</script>