Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

341
Views
¿Por qué bool siempre es FALSO, no se puede reasignar el valor bool en la llamada ajax?

aprendiendo javascript y haciendo una llamada ajax de la siguiente manera:

 var emailExists= function (email) { var bool = false; $.ajax({ url: '@Url.Action("checkEmail")', type: 'POST', data: JSON.stringify({ 'email': email }), contentType: "application/json; charset=utf-8", async: true, success: function (response) { if (response.success) { console.log('success'); } else { console.log('fail'); $('#email-exists').show(); bool = true; } }, error: function (xhr, x, y) { $("body").removeClass("loader-section"); $("div.loader-icon").hide(); console.error('failed', xhr, x, y); } }); console.log(bool); return bool; }

como se puede ver en esta línea,

 console.log('fail'); $('#email-exists').show(); bool = true;

estoy configurando bool para que sea verdadero, sin embargo, nunca reasigna el valor de la variable bool, y siempre imprime y devuelve falso, a pesar del resultado de la respuesta de la llamada ajax

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!