Skip to content

Instantly share code, notes, and snippets.

@AngeloMerlo
Last active December 19, 2015 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AngeloMerlo/6020716 to your computer and use it in GitHub Desktop.
Save AngeloMerlo/6020716 to your computer and use it in GitHub Desktop.
DRY - Ajax usando jQuery
// Não repita a si mesmo - Ajax usando jQuery
// --------------------------------------------
$('input').click(function(){
$.ajax({
url : 'controle.php',
type : 'post',
data : {'dado':valor},
beforeSend: function(){
$('#carregando').fadeIn();
},
timeout: 3000,
success: function(retorno){
$('#resposta').html(retorno);
},
error: function(erro){
$('#resposta').html(erro);
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment