I'm trying to handle errors sent from php script. Here is my code:
<script>
$(document).ready(function() {
$('#signUpForm').submit(function() {
$.ajax({
type: 'POST',
url: "process.php",
data: $("#signUpForm").serialize(),
success: function(data) {
if ((data == "Incorect email format.") || (data == "Username must be between 6-32 signs and only include 0-9, A-Z characters.") || (data == "Password must be between 8-32 signs and only include 0-9, A-Z characters.") || (data == "Passwords do not match.") || (data == "Username is taken, please try another one.")) {
$('#errors').show();
$('#errors').html(data);
} else {
window.location.href = "http://localhost:8888";
}
}
});
return false;
});
});
</script>
Firebug shows that response is sent but errors aren't displayed. Where could be a problem? Thanks.
console.log(data)after success and see on firebug what it's actually coming for you.alert('OK');inif.