There is a simple button. When it is clicked some data is loaded and displayed to the user. It may be some images or data that requires some processing time before it can be displayed and can't be fetched as fast as few lines of text in this example.
Question is : What is the best way to show user that the request is processing?
I can think of two options:
Firstly, user clicks a button and new page is loaded, the data is not displayed (as there is none). While the data is still loading, an animation is shown. (The purple dots that appear for a micro-second)
Secondly, user clicks a button but new page is not loaded. Instead data will be pre-loaded and meanwhile an animation is displayed. While this is loading user can still do other things, or choose to navigate to somewhere else. (For example, something like this plays while the data is being loaded)
Which is better for user? Are there other options?