I have follow / un follow feature on my website.

Currently, you click the button and using PHP and AJAX I change the button background colour.

This is a simple action for the website so doesn't take long and normally it changes instantly.

Just incase, i do have a loading spinner appear over the button when its processing but you dont get a change to see this because of the speed it happens.

I have been playing around with a PHP function called sleep().

When you put e.g. sleep(1); inside your code it will stop the page running for a second before continuing.

I am liking how this feels for the user.

They click the button and can see that something is happening because of there action and then a second later the button changes its colour.

Its only a short 1 second delay. But i am just looking for some other opinions whether this would be effective in aiding the user to see what is going on. Or should it just be instantaneous?


  • I wouldn't do it, for the same reasons as I wouldn't add an artificial load delay: ux.stackexchange.com/questions/41682/… Commented May 25, 2014 at 9:41
  • I understand your reasoning, but personally i feel you're deliberately crippling the UX by forcing loading times, but that's a matter of personal opinion. Using sleep() to do so is very bad practice. Instead, use Javascript to make the AJAX call a second after the button is clicked.
    – Tom
    Commented Aug 25, 2014 at 12:14

1 Answer 1


The option that you have chosen is an elegant solution. You can further spice it up by adding additional emotional element along with loading spinner saying "He/She will miss you" (Rephrase the text depending upon the width). You can get several other button progress samples from this website

  • Thanks for the link! Some amazing samples on that site not just on the button progress. Shall look at implementing some!
    – craig
    Commented May 24, 2014 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.