Click to See Complete Forum and Search --> : newbie question


pbb
09-26-2006, 08:02 AM
Hi all,

I've got the following code, which results in an error "object doesn't support this property or method" on the this.onready() line:

function Foo() {
this.site = "http://www.google.com";
this.onready = function(text) {
alert(text);
// do response processing here
}
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", this.site, true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
var text = xmlhttp.responseBody;
this.onready(text);
// Object doesn't support this property or method
}
}
xmlhttp.send();
}

objFoo = new Foo();

Basically what I want to do is create an object that contains all information for the XHR, including processing functionality. What am I doing wrong?

Thanks, Peter