Thread: newbie question
View Single Post
  #1 (permalink)  
Old September 26th, 2006, 05:47 AM
pbb pbb is offline
Registered User
 
Join Date: Sep 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default newbie question

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:

Code:
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
Reply With Quote