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

108
Views
Loader animation on any fetch api request

I want to add loader animation when a fetch API request is loading data. Tried the old jQuery way, but it does nothing for fetch requests.

jQuery(document).ready(function($){
  $(document).on({
    ajaxStart: function() { $(document.body).addClass("loading");    },
    ajaxStop: function() { $(document.body).removeClass("loading"); },
    ajaxError: function() { $(document.body).removeClass("loading"); }   
  });
});

I want to add this loader when any fetch API request is made, not only for one particular fetch API request, similarly, like the jQuery code above does. It adds\removes class loading when any XMLHtppRequest has started/stopped.

Is there any way of doing this with fetch requests?

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!