So if i fail to login or user does not appear it will prompt a message failed to login or user not found and when that happens i wish the page to reload and go back to the login screen again, i tried with set timeout function but it does not seem to work. Thanks in advance
if (error) {
respond.json(error);
} else {
// If user can be found, result has one record
if (result.length > 0) {
if (input_password == result[0].user_password) {
msg = "1"; // "Success!";
console.log(msg);
} else {
msg = "Login Fail!";
console.log(msg);
}
} else { // If user not found, result has no record
setTimeout(function(){
msg = "User not found!";
window.location.reload(1);
}, 2000);
}