'check get request is complete by JavaScript

A webpage is fully loaded. There is an ajax request on this page that runs every 10 minutes. The callback of this request may take 2 seconds to 20 seconds. How can I make sure the request is complete with JavaScript? Note that I want to add this code to the page and I do not have access to the website code.



Solution 1:[1]

you need to use async

const data = await axios.method('url',{json})
  .then(res => {//action})
  .catch(err => {//action})

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bguiz