Hello
I have an ajax call that simply updates a database using the form values, when a button is pressed.
<script>
function personal(){
$.ajax({
type: "POST",
url: "settings_personal.php",
data: "first_name=" + document.getElementById("first_name").value + "&last_name=" + document.getElementById("last_name").value + "&email=" +
document.getElementById("email").value,
success: $('.save-button').replaceWith('<div class="save-button"><input onclick="personal()" name="update_profile" type="button" value="Saved" class="btn btn-success btn-large"/> <input name="reset" type="submit" value="Reset" class="btn btn-inverse btn-large"/>')
});
}
</script>
the settings_personal.php page contains the sql statements for the update along with validation checks.
Any errors are stored in an array and if an error is detected it won’t perform the update however it will still be detected as a success.
How can I check the errors array using jquery?