XMLHttpRequest Issue

J

jobo

Hello,

var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "asdf.htm",true);

xmlhttp.onreadystatechange=function() {
//ALERT DOES NOT TRIGGER
alert("Status is "+ xmlhttp.readyState)
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)
}
}

I was wondering why the above alert wasn't triggering. The javascript
doesn't seem to have an error. Any ideas? Thanks.
 
L

-Lost

jobo said:
Hello,

var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "asdf.htm",true);

xmlhttp.onreadystatechange=function() {
//ALERT DOES NOT TRIGGER
alert("Status is "+ xmlhttp.readyState)
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)
}
}

I was wondering why the above alert wasn't triggering. The javascript
doesn't seem to have an error. Any ideas? Thanks.

Hehe. Did you try:

xmlhttp.send(null);

....?

-Lost
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top