Created
December 16, 2016 16:58
-
-
Save brunojppb/9ff727ee072f68ae4ccefc1e41228dd3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$('#id-do-form').submit(function() { | |
var valuesToSubmit = $(this).serialize(); | |
$.ajax({ | |
type: "POST", | |
url: $(this).attr('action'), //sumbits it to the given url of the form | |
data: valuesToSubmit, | |
dataType: "JSON" // you want a difference between normal and ajax-calls, and json is standard | |
}).success(function(json){ | |
console.log("success", json); | |
}); | |
return false; // prevents normal behaviour | |
}); | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment