A
avicalc
I need help with the structure of a JavaScript program. My process is
as follows:
1) Get JSON data via XMLHttpRequest.
2) When done with the above, process the JSON data which may take up
to 3 seconds.
3) Because of the possibility of a time consuming operation, display a
simple animation ("Loading...", etc) while the user is waiting.
What I need help with is how to control the animation. I know that I
need to somehow "fork" the expensive process out to another thread
using setTimeout() but I'm not quite sure how to do this either. Also,
I somehow need to integrate the display and hiding of the progress bar
animation while function called by setTimeout() is running. Any help
with the basic structure of this is appreciated.
as follows:
1) Get JSON data via XMLHttpRequest.
2) When done with the above, process the JSON data which may take up
to 3 seconds.
3) Because of the possibility of a time consuming operation, display a
simple animation ("Loading...", etc) while the user is waiting.
What I need help with is how to control the animation. I know that I
need to somehow "fork" the expensive process out to another thread
using setTimeout() but I'm not quite sure how to do this either. Also,
I somehow need to integrate the display and hiding of the progress bar
animation while function called by setTimeout() is running. Any help
with the basic structure of this is appreciated.