XMLHttpRequest has a property onReadyStateChange.
You can assign a function to this such as:
var xmlHttpReq;
function respAjax() {
if (xmlHttpReq.readState == 4) {
}
}
xmlHttpReq.onReadStateChange = respAjax;
Chapter 11 of
Sams_Teach_Yourself_Ajax.. provides much more info, and if you're doing Ajax this is a superb book to read.