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

123
Visualizações
Chain methods with AJAX calls so that they execute in sequential order

I have a React web form with complex validation that runs each time a focus() or blur() happens on each HTML form field. Each of those field events is associated with one or more JavaScript methods. Within those JavaScript methods we do AJAX calls to validate the data entered into the form field (e.g. check to see if the vendor ID is found in the ERP software, etc.).

Now that I've completed all of the field validation logic, I want to include logic on the Submit button where once more it cycles through each of the form fields and executes the relevant validation-related JavaScript methods.

The problem is, these methods need to be called in a particular order. And, in most instances, we need to wait for the AJAX calls embedded in the JavaScript method to finish before moving on to the next call.

I've looked at JavaScript Promises but is it possible to have the Promise wait for the embedded JavaScript AJAX call to complete before moving on to the next then()?

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