Skip to content

Instantly share code, notes, and snippets.

@andrunix
Last active December 13, 2015 17:38
Show Gist options
  • Save andrunix/4949209 to your computer and use it in GitHub Desktop.
Save andrunix/4949209 to your computer and use it in GitHub Desktop.
function showForm() {
$('#upper').slideUp(300);
$('#mail').slideDown(300)
}
function hideForm() {
$('#mail_form')[0].reset();
$('#mail').slideUp(300);
$('#upper').slideDown(300);
$('#error').html('');
$('#error').hide();
}
$(document).ready(function() {
Uncaught ReferenceError: $ is not defined
$('#error').hide();
$('#notice').hide();
$('#mail').hide();
$('#contact').click( function() {
showForm();
});
$('#submit').click( function() {
$.post("contact.php", $("#mail_form").serialize(),
function(data){
if (data.status == "OK") {
$('#notice').html(data.notice);
$('#notice').fadeIn(200).delay(4000).fadeOut(2000);
hideForm();
}
else {
$('#error').html(data.notice);
$('#error').fadeIn(200);
}
}, "json");
});
$('#cancel').click( function() {
hideForm();
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment