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?