V
Vincent
Hi all,
I've seen a lot of ajax examples on the web that used an event handler
called 'processChange' for the onreadystatechange event. Normally,
this looks like this:
if(window.XMLHttpRequest) obj = new XMLHttpRequest();
else if(window.ActiveXObject) obj = new
ActiveXObject('Microsoft.XMLHTTP');
obj.onreadystatechange = processChange;
....
function processChange(){
if(obj.readystate != 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.readystate
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 onreadystatechange event. Normally,
this looks like this:
if(window.XMLHttpRequest) obj = new XMLHttpRequest();
else if(window.ActiveXObject) obj = new
ActiveXObject('Microsoft.XMLHTTP');
obj.onreadystatechange = processChange;
....
function processChange(){
if(obj.readystate != 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.readystate
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