I wanted to add loading spinner to the web application that I was working on. This application is a legacy application and I was looking into a way to add the loading spinner whenever the user performs certain actions such as the following
- Clicks a button which behind the scene performs CRUD operation
- When user request data
As the web application was based of JSP and I was looking for a way to adding it to the webpage and finally came across the following solution
- Create a div
- Add the CSS for the div
- Create a JS function which gets called on button click.
Here is the code