Skip to content

Instantly share code, notes, and snippets.

@dvidsilva
Created October 20, 2015 19:04
Embed
What would you like to do?
AJAX submit form with Jquery
$(document).ready(function() {
$('form').submit(function(event) {
event.preventDefault();
var formData = $(this).serialize();
$.ajax({
type : 'POST',
url : $(this).attr('action'),
data : formData,
dataType : 'json',
encode : true
}).done(function(data) {
console.log(data);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment