S
SE
Hi all,
Apologies if this has been done before.
I am trying to do some stuff with XMLHttpRequest in mozilla but no dice. I
have finally pared everything down to the minimum to see what is happening
with this script
-----------------------------------------------------
xmlhttp = new XMLHttpRequest();
alert(xmlhttp);
// }
alert("Trying the test now");
xmlhttp.open("GET", "test.txt",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) alert("URL Exists!");
else if (xmlhttp.status==404) alert("URL doesn't exist!");
else alert("Status is "+xmlhttp.status);
}
}
xmlhttp.send(null);
alert(xmlhttp.status);
document.write("Status is " + xmlhttp.status);
xmlhttp.send(null);
--------------------------------------------------
The first alert box comes up telling me that xmlhttp is an object. The
second box telling me that it is about to try getting the file comes up,
THEN NOTHING!
I am running the script on an Apache server.
Any help gratefully received.
Thanks.
Steve
Apologies if this has been done before.
I am trying to do some stuff with XMLHttpRequest in mozilla but no dice. I
have finally pared everything down to the minimum to see what is happening
with this script
-----------------------------------------------------
xmlhttp = new XMLHttpRequest();
alert(xmlhttp);
// }
alert("Trying the test now");
xmlhttp.open("GET", "test.txt",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) alert("URL Exists!");
else if (xmlhttp.status==404) alert("URL doesn't exist!");
else alert("Status is "+xmlhttp.status);
}
}
xmlhttp.send(null);
alert(xmlhttp.status);
document.write("Status is " + xmlhttp.status);
xmlhttp.send(null);
--------------------------------------------------
The first alert box comes up telling me that xmlhttp is an object. The
second box telling me that it is about to try getting the file comes up,
THEN NOTHING!
I am running the script on an Apache server.
Any help gratefully received.
Thanks.
Steve