hi
i have made a hello world AJAX application but it does not give required output.i want to display result in 2nd textfield..but the condition "if(xmlHttp.readyState==4)" never becomes true...here is the code(both client and server side).plz help me in finding error
Client Side:-
<script>
var xmlHttp;
function startReq(){
createXmlHttpRequest();
var u1=document.myForm.tf1.value;
xmlHttp.open("GET","http://localhost:8084/AJAX/Taymoor?user="+u1 ,true);
xmlHttp.onreadystatechange=handleStateChange();
xmlHttp.send(null);
}
function createXmlHttpRequest(){
if(window.ActiveXObject)
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
else
xmlHttp=new XMLHttpRequest();
}
function handleStateChange(){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
var message =xmlHttp.responseXML.getElementsByTagName("message")[0].childNodes[0].nodeValue;
alert(message);
document.myForm.tf2.value=message;
}else{
alert("Error loading pagen"+ xmlHttp.status +":"+xmlHttp.statusText);
}
}
}
</script>
Bookmarks