AJAX and Localhost?

Associate
Joined
1 Feb 2006
Posts
1,868
Location
Reading
Anyone had any experience with AJAX playing up when using it on a website ran locally?

I'm getting infuriated because my incredibly simple ajax example is not working. Once I have called open on the http request object some error occurs which clearly doesn't trip the main javascript error handler. The target script page doesn't get executed at all and responseText is empty after readystate gas settled on 4, trying to access the status property of the http request object after open does trigger a global error however. ([Exception... "Component returned failure code: 0x80040111
(NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]")


Sorry if that isn't very coherent, I'm just frustrated and quickly laying down my problem before I go off to eat.


Simple code:
Code:
var url="insert.php";
    xmlHttp.onreadystatechange=function() {
      if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
        //document.write(xmlHttp.responseText);
      };
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

The server side script merely echos "Success"
 
Last edited:
Back
Top Bottom