Best way to display a loading spinner in Django?
Wh开发者_JS百科at is the best way to display a loading spinner in Django during a relatively lengthy server-side processing task? Is this something that JS/jQuery should handle?
If so, how do I get the button click that starts the server-side processing to initiate the spinner?
Django novice here, so I appreciate any input. Thanks!
There are many ways of doing this, I'm going to suggest the simplest:
Use an animated gif
yes. I know, you're probably thinking, "animated gifs are tacky!"
to which I reply: "only if they're ugly."
Make a simple loading spinner animation as a gif, and add it to the display list when you want it shown. When the process is over, remove it from the display list.
It's about the only good use of an animated gif I've ever come up with.
精彩评论