Skip to content

Instantly share code, notes, and snippets.

@dvidsilva dvidsilva/submit.js
Created Oct 20, 2015

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
You can’t perform that action at this time.