Skip to content

Instantly share code, notes, and snippets.

@felipeorlando
Created October 14, 2016 16:09
Show Gist options
  • Save felipeorlando/65d3d73667fe87a3bcdd93048ea21ce3 to your computer and use it in GitHub Desktop.
Save felipeorlando/65d3d73667fe87a3bcdd93048ea21ce3 to your computer and use it in GitHub Desktop.
;(function() {
var submitContact = function() {
$.ajax({
url: '/contato',
method: 'POST',
dataType: 'JSON',
data: $('#form').serialize(),
success: function(data) {
if (data) {
$('.msg-success').show();
$('form').find('input.validate').val('');
} else {
$('.msg-error').show();
}
}
});
};
$(document)
.on('submit', '#form', submitContact)
;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment