I am making an Ajax request for a PHP page that returns me several XML data. If I make a simple recovery code by directly opening the PHP page, of course, however, I'm requesting another page that calls the data from another PHP via Ajax with Jquery.
My role today:
$.ajax({
url: "consultaPlaca.php",
type: "get",
data: {placa : 'XXX9999'},
success: function (retorno) {
teste = retorno;
console.log(retorno.Placa.text());
localStorage.setItem('placa', $("placa").text());
localStorage.setItem('renavam', $("renavam").text());
localStorage.setItem('tipo', $("tipo").text());
localStorage.setItem('marca', $("marca").text());
localStorage.setItem('modelo', $("modelo").text());
localStorage.setItem('importado', $("importado").text());
localStorage.setItem('combustivel', $("combustivel").text());
localStorage.setItem('cor', $("cor").text());
localStorage.setItem('categoria', $("categoria").text());
localStorage.setItem('roubofurto', $("roubofurto").text());
localStorage.setItem('roubofurtocodigo', $("roubofurto roubofurtocodigo").text());
localStorage.setItem('roubofurtodescricao', $("roubofurto roubofurtodescricao").text());
localStorage.setItem('roubofurtocomplemento', $("roubofurto roubofurtocomplemento").text());
localStorage.setItem('anofabricacao', $("anofabricacao").text());
localStorage.setItem('anolicenciamento', $("anolicenciamento").text());
localStorage.setItem('anomodelo', $("anomodelo").text());
localStorage.setItem('ipva', $("ipva").text());
localStorage.setItem('inspecaoveicular', $("inspecaoveicular").text());
localStorage.setItem('multascetesb', $("multascetesb").text());
localStorage.setItem('multasder', $("multasder").text());
localStorage.setItem('multasdersa', $("multasdersa").text());
localStorage.setItem('multasdetran', $("multasdetran").text());
localStorage.setItem('multasmunicipais', $("multasmunicipais").text());
localStorage.setItem('multasprf', $("multasprf").text());
localStorage.setItem('observacoes', $("observacoes").text());
localStorage.setItem('registroguincho', $("registroguincho").text());
localStorage.setItem('restricaoadministrativa', $("restricaoadministrativa").text());
localStorage.setItem('restricaofinanceira', $("restricaofinanceira").text());
localStorage.setItem('restricaojudiciaria', $("restricaojudiciaria").text());
localStorage.setItem('restricaotributaria', $("restricaotributaria").text());
localStorage.setItem('totalmultas', $("totalmultas").text());
localStorage.setItem('totalimpostos', $("totalimpostos").text());
localStorage.setItem('total', $("total").text());
localStorage.setItem('datahora', $("datahora").text());
localStorage.setItem('status', $("transacao status").text());
localStorage.setItem('codigostatus', $("transacao codigostatus").text());
localStorage.setItem('codigostatusdescricao', $("transacao codigostatusdescricao").text());
}
});
This works if I play directly on the console of the page that does the query, but via AJAX get, the data comes, but I can not get it by doing just that: retorno.placa.text();