Hi all,
I've seen a lot of ajax examples on the web that used an event handler
called 'processChange' for the onreadystatecha nge event. Normally,
this looks like this:
if(window.XMLHt tpRequest) obj = new XMLHttpRequest( );
else if(window.Activ eXObject) obj = new
ActiveXObject(' Microsoft.XMLHT TP');
obj.onreadystat echange = processChange;
....
function processChange() {
if(obj.readysta te != 4) return;
if(obj.status == 200){
// do something
}
}
Well, this works on IE6 and Firefox, but I would like to use this
instead of obj inside of the processChange function (this.readystat e
and this.status). This works fine on firefox, but on IE6 it doesn't.
Can someone tell me why?
For the record, I want to use this instead of obj because I want to
make a series of request with a for loop and since happens all inside
of the same closure, obj would refer to the last instance of my
xmlhttprequest.
Thanks,
Vincent
I've seen a lot of ajax examples on the web that used an event handler
called 'processChange' for the onreadystatecha nge event. Normally,
this looks like this:
if(window.XMLHt tpRequest) obj = new XMLHttpRequest( );
else if(window.Activ eXObject) obj = new
ActiveXObject(' Microsoft.XMLHT TP');
obj.onreadystat echange = processChange;
....
function processChange() {
if(obj.readysta te != 4) return;
if(obj.status == 200){
// do something
}
}
Well, this works on IE6 and Firefox, but I would like to use this
instead of obj inside of the processChange function (this.readystat e
and this.status). This works fine on firefox, but on IE6 it doesn't.
Can someone tell me why?
For the record, I want to use this instead of obj because I want to
make a series of request with a for loop and since happens all inside
of the same closure, obj would refer to the last instance of my
xmlhttprequest.
Thanks,
Vincent
Comment