Am trying to redirect to a page based on my response. But am doing it wrong. Tried the answers Here But not working. my Ajax script is below.
success: function (response) {
if (response === 'success') {
window.location.replace("home");
} else {
$(".error_message").fadeIn();
$(".error_message").html("");
$(".error_message").html(response);
$(".error_message").fadeOut(5000);
}
}
My php code is below
if ($stmt->execute()) {
echo "success";
}
$stmt->close();
It echoes the message after the form was submitted successfully.
But i want it to reload not getting stuck at the same page.