0
Through JQUERY, I need to make a request via POST
where I’ll get a JSON
with a token.
The JSON return I get after sending the POST is this:
{
"Token": "e27bb0a7-e65b-4cc3-a82e-7a2a3c26a248",
"Codigo": 0
}
My question is: How do I read this token? An analyst told me that I should do something more or less like this:
$(document).ready(function() {
var settings = {
"async": true,
"crossDomain": true,
"url": "https://siteexemplo.br/login/geraTok",
"method": "POST",
"headers": {
"content-type": "application/json",
},
"data": {
"RA": "12345",
"senha": "xxx"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
});
But after that? Where’s the token? How to pass it to a variable for example?
Personal thank you!
speaks @Rafael Acioly, I believe that accessing the keys of a JSON would not be a correct term, JSON is for transfer only, when interpreted by javascript can already be treated as object, vlw!
– Felipe Duarte