Skip to content

Instantly share code, notes, and snippets.

@BrunoDSouza
Last active June 20, 2018 14:27
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 BrunoDSouza/de35e026882a2b7e2ad39fed171b53ca to your computer and use it in GitHub Desktop.
Save BrunoDSouza/de35e026882a2b7e2ad39fed171b53ca to your computer and use it in GitHub Desktop.
Function to return response of request Ajax with jquery
function requestCliente(dados, url) {
return $.ajax({
url: url,
contentType: "application/json; charset=utf-8",
responseType: "json",
dataType: "json",
data: dados,
cache: false
})
.done(function (data) {
if (data.Sucesso)
return data.Retorno
})
.fail(function (error) {
alert("Erro ao consultar dados!")
throw
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment