Last active
June 20, 2018 14:27
-
-
Save BrunoDSouza/de35e026882a2b7e2ad39fed171b53ca to your computer and use it in GitHub Desktop.
Function to return response of request Ajax with jquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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