AJAX Ready State Never Reaches 200
So I'm new to javascript and I'm actively trying to learn it for work. However, the project I've been working on has come to a screeching halt because my program never reaches the 200 ready state. can anyone help?
Code:
<html>
<head>
<script>
function queryDB(cpid, radar, year, month, day)
{
if (day=="")
{
document.getElementById("result").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
alert(xmlhttp.readyState + " " + xmlhttp.status);
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("result").innerHTML=xmlhttp.responseText;
}
}
var url="query.php?cpid="+cpid+"&radar="+radar+"&year="+year+"&month="+month+"&day="+day;
xmlhttp.open("GET",url, true);
xmlhttp.send();
}
</script>
</head>