Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Ajax the combination of XHTML, CSS, DOM, XML, XSLT, XMLHttpRequest, and JavaScript
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Ajax section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie question savoym JSP Basics 1 August 16th, 2006 03:15 AM
Newbie Question - Sorry! KP Crystal Reports 1 June 13th, 2006 02:45 AM
C# Newbie Question jazzcatone ASP.NET 2.0 Basics 1 May 25th, 2006 10:18 PM
newbie question Warbird XML 0 May 11th, 2005 08:41 AM
Newbie question maccer88 Access 1 October 18th, 2003 05:53 PM





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