I have a function that calls a HTML code switch when the 'signup' button is clicked. The problem I am having is when I test for a wrong password or wrong email on sign up. I successfully check if the data is correct, but it loads the previous html. Do you know how I can prevent this?
$(document).ready(function(){
$("#signupButton").click(function(e){
e.preventDefault();
$.ajax({url: "/bookwebsite/html/signup.txt", success: function(result){
$("body").html(result);
}});
});
Above code is the way ajax switches out the HTML body which leads to the 'signup' page.
//confirm password and confirmed password are the same
if($signup_password != $signup_password_confirm){
echo "<font color='red'>Passwords do not match</font>";
//session_destroy();
//echo $signup_password . $signup_password_confirm;
break;
}
Above code is the PHP that checks that passwords are matching. The commented stuff is things I was just trying.
Thank you!