Hi Guys,
I am having problem with AJAX script in my ASP page.

<script type="text/javascript">
function ajaxFunction()
{
var xmlHttp;
var isValid;

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()
{
if(xmlHttp.readyState==4)
{
document.frmPasswordResetHome.Validation_Message.v alue=xmlHttp.responseText;
}
}
var url;

url = "UpdateRegistrationValidation.asp?txtEmployeeID_Up date_Reg=" + document.frmPasswordResetHome.txtEmployeeID_Update _Reg.value + "&Session_ActionDomainLoginName=" + document.frmPasswordResetHome.Session_ActionDomain LoginName.value;

xmlHttp.open("GET",url,true);
xmlHttp.send(null);

isValid = document.frmPasswordResetHome.Validation_Message.v alue;

//alert(isValid);

if (isValid == "True")
alert("True");
else
alert("False");
}
</script>
And the code in UpdateRegistrationValidation.asp file is as follows
<%
Response.Write "True"
%>

Now lemme tell ya that the problem I am facing. I always get the alert message as "False" for the 1st time. But from the second time I always get the "True" message.

I also found that the text field "Validation_Message" gets filles with the value "True", quite late.

Any one can please help me on this.


Thanks,
Rahul Jha