async await for fetching data with spinner in javascript [source code] given below-


Script will look like:

const getMeta = async () => {
    try {
      let URL = `${externalUrl}`
      spinner.src = "/assets/images/Spinner-2.gif"
      // inside spinner src u put your own loader
      await axios.get(URL)
      .then(response => {
      spinner.src = ""
      //response can append inside any html elements.
    } catch (error) {

If you have no any amazing loader and spinner then please visit this site -


Trust me! you will get best loader that you want for your amazing sites.

some cool loaders preview:

Hopefully, If you get your answer, then please share this post with your technical friends.