OK, I'm an AJAX newbie, and I just had a quick question.
My goal is to have a loading icon appear and disappear while an xmlhttprequest is being executed. My question is, when should I make the loading icon appear and disappear. I know this may seem trivial, but I just wanted to clarify the timeline of an AJAX request.
Should its dis/appearance be dependent on ready state changes, or should it bet dependent on when functions are executed?
When should I make the div which contains the loading icon visible?
a. When the open() function is invoked
b. When the send() function is invoked
c. When the readystate changes to 2
d. When the readystate changes to 3
I assume I should make it disappear when the readstate changes to 4, but is that correct?
Sorry for the barrage of questions, just wanted to get some clarity on this.