Newbie: "http.open() is not a function" ??
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Donald_Ravey
Posted On:   Monday, August 21, 2006 07:31 PM

I'm just starting to learn Ajax and I can't get anywhere, because the example code I've copied from the book "Learn Ajax in 10 Minutes" (hah!) by Paul Ballard doesn't instantiate XMLHTTPRequest object, for two different examples, on two servers (one WinXP, one Linux), using several browsers! I've carefully checked the code for typos, as well as compared it with code found on the web, and it really looks correct. But I get the "xxx.open() is not a function" error every time. I'm assuming that it just isn't instantiating the object, but I don't know what to do next. I could include my code, but it's REALLY basic and copied directly out of the book. Any tips will be appreciated. Don    More>>

I'm just starting to learn Ajax and I can't get anywhere, because the example code I've copied from the book "Learn Ajax in 10 Minutes" (hah!) by Paul Ballard doesn't instantiate XMLHTTPRequest object, for two different examples, on two servers (one WinXP, one Linux), using several browsers!


I've carefully checked the code for typos, as well as compared it with code found on the web, and it really looks correct. But I get the "xxx.open() is not a function" error every time. I'm assuming that it just isn't instantiating the object, but I don't know what to do next.


I could include my code, but it's REALLY basic and copied directly out of the book.


Any tips will be appreciated.


Don    <<Less

Re: Newbie: "http.open() is not a function" ??

Posted By:   Anonymous  
Posted On:   Thursday, September 21, 2006 11:39 AM

You have to instantiate XMLHttpRequest.


var http_request = false;


if (window.XMLHttpRequest) { // Mozilla, Safari, ...

   http_request = new XMLHttpRequest();

Try that.

Re: Newbie: "http.open() is not a function" ??

Posted By:   Anonymous  
Posted On:   Wednesday, August 23, 2006 09:37 AM

I'm not sure if I understood the problem correctly, but you really have to do:

var xmlhttp = new XMLHttpRequest();


At some point.
About | Sitemap | Contact