Skip to content

Instantly share code, notes, and snippets.

@wellingtonpgp
Created January 7, 2017 15:48
Show Gist options
  • Select an option

  • Save wellingtonpgp/ee1f7f2c74c03b968334df268a09baf7 to your computer and use it in GitHub Desktop.

Select an option

Save wellingtonpgp/ee1f7f2c74c03b968334df268a09baf7 to your computer and use it in GitHub Desktop.
Função para retornar mensagem com jquery e bootsrap
function msg(msg, tipo) {
var retorno = $('.retorno');
var tipo = (tipo === 'sucesso') ? 'success' : (tipo === 'alerta') ? 'warning' : (tipo === 'erro') ? 'danger' : (tipo === 'info') ? 'info' : alert('Informe a mensagem');
retorno.empty().fadeOut('fast', function () {
return $(this).html('<div class="alert alert-'+tipo+'">'+msg+'</div>').fadeIn('slow');
});
setTimeout(function () {
retorno.fadeOut('slow').empty();
}, 9000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment