My JS wont cooperate and redirect... Can anyone see my problem? Tried all day, it's like nothing works :(
function validate(form) {
if (form.username.value==="admin") {
if (form.password.value==="1") {
$('#loginLock').css({opacity: 0});
$('#loginUnlock').css({opacity: 1});
document.cookie="username=Admin";
setTimeout(function(){ window.location.replace = 'vault.php';}, 1500);
} else {
alert("Forkert brugernavn eller password");
}
} else {
alert("Forkert brugernavn eller password");
}
}
You can use window.location.href
setTimeout(function(){ window.location.href= 'vault.php';}, 1500);
instead of
setTimeout(function(){ window.location.replace = 'vault.php';}, 1500);
Use javascript's setTimeout method:
// redirect to google after 5 seconds
window.setTimeout(function() {
window.location.href = 'http://www.google.com';
}, 5000);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With