Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda