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

430
Views
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 answers
Answer question

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 Report
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!