I use it on an intranet that I developed for notification purposes. Intercepting state 3, I can notify the user of the start of the request.
I also use it during request transmission time. I show the elapsed time between states 3 and 4.
Since I use MooTools, I extended the Request class to fire the onStateChange event:
var EarlyRequest = new Class({Extends: Request,
onStateChange: function() {
this.fireEvent("onStateChange", [this.xhr.readyState]);
this.parent();
}
});
Additional note. The definitions of the states you posted (from w3cschools) are misleading, this is clearer for me (from http://www.w3.org/TR/XMLHttpRequest/#states ):
UNSENT (numerical value 0)
object is constructed.
( 1)
open() . setRequestHeader(), send().
HEADERS_RECEIVED ( 2)
( ) , HTTP- . .
( 3)
.
( 4)
- (, ).