i dont know why my onreadystatechange function is not working

var xmlhttp;

var time;
function init()
{
time=0;
t=setInterval("timer()",1000);
}
function timer()
{
time++;
}
function sendrequest(v,qno)
{
if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4 && xmlhttp.status==200)
{
alert("Came Inside");
postdata(v,qno);
}
}
}
function postdata(v,qno)
{

var l="http://localhost:90/reactiontime/calculate.php?value="+v+"&time="+timer+"&q="+qno;
alert(l);
if(xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("sentence").innerHTML=xmlhttp.response;
}
xmlhttp.open(GET,l,true);
xmlhttp.send(null);
}

the alert box inside onreadystatechange is not showing up

Just if you're after a quicker response, please FORMAT your code by using either of thse options " Code " or " Inline code "

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.