Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+6 votes
in Q2A Core by
Hi all. I'm continuing to work on Q2A 1.5.3, and the latest code is running on this site.

You should be able to see spinners for almost all Ajax actions, e.g. adding answers or comments.

But I have a question for the audience. Do you think the voting buttons should show an Ajax spinner? It would look something like the one you see on the favoriting 'plus' in the top right. In principle the answer should be yes, but it doesn't feel right to me.

Any opinions?
@Merkus: well put
There is no spinner when asking a question?
No spinner when asking a question because it doesn't happen via Ajax - the point of a spinner is to give the user a sense that something is happening even when their browser is not showing that.
mhh, waiting 3 sec here on q2a.org before my question gets posted (i.e. my browser reacts)... from the user view I would suggest to implement a spinner there as well.

5 Answers

+1 vote
i dont think ajax loading should show spinners. It should be instantaneous.
That is technically impossible since (a) there is latency between the client browser and the server and (b) it takes time for the server to process the request. The question is what to do while the browser is waiting for a response.
actually it does not matter from an audience point of view. at least in my opinion.
yes thats true, but it will noticed if the waiting time is more, depending on the server connection response.
It does matter. That will indicates "action in process"  to the user who is submitting the action.
0 votes
No spinner. But thanks for the small details.
–4 votes
Sorry for my bad english..

1.5.3 need multi language support..

script need a social buttons.. not a plugin! origin buttons for script for all questions..

And twitter login button.
I don't think this post was intended for general suggestions, only those relating to the AJAX spinner.

Anyway Q2A already has multi language support and has for years!
You can easily add social buttons in the admin, just get the code from somewhere and add it to sidebar or other location.
+1 vote

For the voting buttons, what Stack Overflow does is immediately change the button state, but reverse that if there is a problem (e.g. not being logged in, not having enough rep). In other words:

  1. User clicks upvote.
  2. Image changes to "upvoted" style.
  3. AJAX request is sent to the server.
  4. If server responds with an OK message, nothing happens.
  5. If something goes wrong or user is not allowed to vote, it returns an error message etc. and the vote style goes back to normal.

I think that works fine, but IIRC in Q2A the server returns the HTML code of the button state, so you would need to change the Javascript so that it can change the state instantly. Probably not worth it for such a small improvement.

I don't think the favourites/best answer buttons need spinners either as they are short operations. I was trying to think if there is another way to indicate something is happening on icon buttons like these but I can't think of anything.

I would keep the spinner only to places where you are saving text, like in answers/comments.

Edit: also the spinner doesn't appear to be properly transparent, it looks a bit strange on the blue background:

Thanks. On the question of favorites/best answer spinners, I quite like having them there. But it's easy to change via CSS - there are already rules like this in the CSS file, and you can add display:none;

.qa-favoriting .qa-waiting {position:absolute; padding:6px 4px;}
.qa-a-selection .qa-waiting {position:absolute; padding:7px 0;}
+3 votes
edited by
In some cases it takes a long time before the result of the voting action is shown, resulting in a confused user. However in other cases it is almost instantly. Therefore my suggestion would be:

- do not show spinner by default

- show spinner after a slight delay if the ajax request is not yet finished (e.g. 0.2 seconds)

This way, we have the best of both worlds.
I was also thinking for this solution. Only show spinners if there is some time delay.
I think yes little delay is good idea.