Skip to content

Instantly share code, notes, and snippets.

@claudiohilario
Last active November 14, 2017 22:39
Show Gist options
  • Save claudiohilario/6958fce3f8c4372c65cc839fc89d02e9 to your computer and use it in GitHub Desktop.
Save claudiohilario/6958fce3f8c4372c65cc839fc89d02e9 to your computer and use it in GitHub Desktop.
Exemplo de envio através de ajax jQuery
$("form").submit(function(e) {
e.preventDefault();
var data = $(this).serialize();
var url = $(this).attr("action");
var form = $(this);
$.ajax({
type : 'post',
dataType : "json",
url : url,
data : data,
success : function(data){
alert(data);
},
error:function(data){
alert('Ocorreu um erro!')
}
});
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment