What's a better and more elegant way of writing this:
$('#footer form').submit(function(event) {
event.preventDefault(event);
$('#footer form .preload').spin(opts);
$.post('contact.php', $(this).serialize(), function(response) {
$('#footer form .preload div').remove();
$('#footer form h5').remove();
$('#footer form .error').html('');
if (response == 1) {
$('#footer form h3').after('<h5>Your message has been sent!</h5>');
$('#footer form input[type=submit]').fadeOut();
} else if (response == 0) {
$('#footer form h3').after('<h5>A problem occured. Please try again later.</h5>');
$('#footer form input[type=submit]').fadeOut();
} else {
var errors = $.parseJSON(response);
$('label[for=name] .error').html(errors.name);
$('label[for=email] .error').html(errors.email);
$('label[for=message] .error').html(errors.message);
}
});
});