Error while capturing an existing data

0

I have two AJAX services. In one of them I search the user data in a JSON that an API returns me, I parse it and I ask that it insert a certain data for me in a tag

. The code is this:

if(xhr.status == 200){

    console.log(xhr.responseText);

    let ultimaAula = xhr.responseText;
    ultimaAula = JSON.parse(ultimaAula);

    let ultimaAulaAcessada = "";
    ultimaAulaAcessada += ultimaAula.ultimaAulaAcessada;
    document.querySelector("#ultima-aula").innerHTML = ultimaAulaAcessada;

}

Well, he picks up the id of the last class and inserts it for me in # last-class. So far so good. It inserts in this tag

<p id="ultima-aula"></p>

Now I have another service that needs to retrieve this data to perform another action for me.

I do his AJAX and it says that in the # last-class is the id he needs to run the service, but he says the field is empty and is not because I see the id being displayed on the screen. What can it be?

    
asked by anonymous 28.04.2018 / 00:51

0 answers