Ajax spinners and why they are essential

I was having a conversation with another developer last week who was of the opinion that Ajax spinners (those little circles that spin round while a web page page is loading) are a waste of time. His view was that if you need to display a spinner when your content is loading, then you should improve the performance of your site!

I had to disagree with his opinion for the following reason: sometimes shit just happens, and that can dramatically impact the performance of even the most finely tuned website or back-end. More often than not, these issues are totally out of your control too! The internet is full of unpredictability and as developers we need to plan to cope with these events as gracefully as possible, reducing the perceived impact to the user experience.

When a non-Ajax page is loading, web browsers will usually have some indicator that the page is loading to keep the user informed. However because Ajax-powered websites only refresh the content within the already loaded document rather than refreshing the entire browser window, the browser provides no visual indication to the user that their page is being loaded.

As such, it is essential to provide visual feedback to the user that their click/swipe/hover has been registered, and you’re responding to it in some form.

As a rule, I will always use a spinner of some sort in any page that loads Ajax content, and then hide that spinner when the content has been loaded. This is very easy to do with AngularJS by using the ng-show and ng-hide attributes before and after the Ajax call is executed.

So there’s really no excuse – if you’re using Ajax to load any data in your site then you should be using spinners to provide feedback to your users. It would be rude not to, and we wouldn’t want to be rude would we…

Tagged with: ,