Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

150
Visualizações
How to get variable created in ajax.done outside of the function

The issue that the below code snippet has is the value of data.status is not conserved out of the ajax.done function. I've already tried as shown in the below snippet to make a hidden input and add the value attribute with the value of data.status. This has also failed. My only conclusion is that the value is only conserved while inside of the ajax.done function even if the value attribute was assigned to the hidden input then outside of the ajax.done function it will return as "undefined". How could I get the value of data.status outside of the ajax.done function.

$.ajax({
    method: 'POST',
    url: "{{ url_for('admin.adminAccountsValidateUserManagementProcessName') }}"
}).done(function(data) {
    console.log(data.status);
    $("#hidden-inpt").attr("value", data.status);
    console.log("hidden input value: ", $("#hidden-inpt").attr("value"));
});
let status = $("#hidden-inpt").attr("value");
console.log(status);
return false;
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda