Wednesday, 1 May 2019

Adding loading spinner while waiting for backend response (using async await)

Building a site with Node and templating engine. Load new data as such ...const { data } = await axios.get(/api/getdata` ); $('.home').innerHTML = data;` All works fine well, but there's a small a small gap whilst the data returns and I want to add a spinner to signify "loading".So as javascript will have to be controlled by adding and removing classes I imagine. Just not quite sure how to addClass whilst waiting for axios response.Thanks

Submitted May 01, 2019 at 03:38PM by harrydry

No comments:

Post a Comment