<html>
<head>
</head>
<body>
<script type="text/javascript">function ajaxFunction()
{var xmlHttp;
try
{ // Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{ // Internet Explorer
try
{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e)
{ try
{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
catch (e)
{ alert("Your browser does not support AJAX!"); return false; } } }
xmlHttp.onreadystatechange=function()
{
//alert("i m not in ready state");
if(xmlHttp.readyState==0)
{
//document.myForm.time.value=xmlHttp.responseText;
alert("The request is not initialized");
}
if(xmlHttp.readyState==1)
{
//document.myForm.time.value=xmlHttp.responseText;
alert("The request has been set up");
}
if(xmlHttp.readyState==2)
{
//document.myForm.time.value=xmlHttp.responseText;
alert("The request has been sent");
}
if(xmlHttp.readyState==3)
{
//document.myForm.time.value=xmlHttp.responseText;
alert("The request is in process");
}
if(xmlHttp.readyState==4)
{
//document.myForm.time.value=xmlHttp.responseText;
//alert("i m in ready state");
document.getElementById("theResponse").innerHTML = xmlHttp.responseText;
}
}
var gender=document.myForm.gender.value;
var url="getAllGender.jsp";
url=url+"?gender="+gender+"&sid="+Math.random();
//url=url+"&sid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
</script>
<form name="myForm">
<select name="gender" onChange="ajaxFunction(); ">
<option >Select gender</option>
<option>Male</option>
<option>Female</option>
</select>
<div id="theResponse">
</div>
</form></body>
</html>