Skip to content

Instantly share code, notes, and snippets.

@RimonEkjon
Forked from jswhisperer/ajax a form jquery
Created August 26, 2014 03:40
Show Gist options
  • Save RimonEkjon/5c8a2997b620cb96368c to your computer and use it in GitHub Desktop.
Save RimonEkjon/5c8a2997b620cb96368c to your computer and use it in GitHub Desktop.
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