Skip to content

Instantly share code, notes, and snippets.

@FlokiTV
Created June 2, 2020 15:31
Show Gist options
  • Save FlokiTV/4789a7c8f8a8552a5b883d605301657d to your computer and use it in GitHub Desktop.
Save FlokiTV/4789a7c8f8a8552a5b883d605301657d to your computer and use it in GitHub Desktop.
asynFunc.js
// https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Statements/funcoes_assincronas
function recuperarDadosdeSessao(){
return new Promisse( resolve => {
$.ajax({
url:'../resource/Sessoes/Sessoes.php',
type:'GET',
dataType:'json',
success: function(retorno){
resolve(retorno)
},
error: function(retorno){
resolve(retorno)
}
});
})
}
// USANDO
dados = await recuperarDadosdeSessao()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment