Skip to content

Instantly share code, notes, and snippets.

@jswhisperer
Created June 23, 2013 14:34
Show Gist options
  • Save jswhisperer/5845228 to your computer and use it in GitHub Desktop.
Save jswhisperer/5845228 to your computer and use it in GitHub Desktop.
ajax a form jquery
var form = $('#contactForm');
form.submit(function(event) {
$.ajax({
type: form.attr('method'),
url: form.attr('action'),
data: form.serialize(),
success: function (data) {
alert('ok');
}
});
event.preventDefault();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment