p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Ajax (http://p2p.wrox.com/forumdisplay.php?f=210)
-   -   newbie question (http://p2p.wrox.com/showthread.php?t=48303)

pbb September 26th, 2006 05:47 AM

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


All times are GMT -4. The time now is 08:41 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.