I have a form such as :
$('form[name=contact]').submit(function(){
// Maybe show a loading indicator...
$.post($(this).attr('action'), $(this).serialize(), function(res){
// Do something with the response `res`
console.log(res);
// Don't forget to hide the loading indicator!
});
return false; // prevent default action
});
See: