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

425
Visualizações
Display loading screen immediately after button press and before AJAX call is fired

I am trying to display the loading element displayed immediately after the button press and before the AJAX call is made.

Here is my code and what I have tried:-

This code is inside my "on button click" function

$('.loading-container').fadeIn(0);
$('.loading-container').show();
$('.loading-container').css('display', 'block');

console.log("start");

setTimeout(function () {
    getResults();
    console.log("end");
}, 3600);

I have tried the beforeSend as well but it does not display the loading screen immediately after the button click.

The problem is that loading screen shows 4 or 5 seconds after the button click. How can I make it show immediately after the button click?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use async await, here is the reference: MDN - async function or you can use promises which are basically the same (MDN - Promises).

about 4 years ago · Juan Pablo Isaza Relatório
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