satish_j
10-08-2008, 09:53 AM
I have an issue running my first Ajax script.Iam checking for a loginid field entered by user for availaibility.Iam connecting to database through ajax to check for existence of the same.
The html+Javascript code for Ajax request object is as follows:
<html>
<head>
<title>Registration Form</title>
<script language="javascript" type="text/javascript">
function checkId() {
var ajaxreq;
try {
ajaxreq=new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e) {
try{ ajaxreq=new ActiveXObject("Msxml2.XMLHTTP"); }
catch(e2) {
try{ajaxreq=new XMLHTTPRequest; }
catch(e3) {
alert('Pls update your Browser to use this feature');
return false; }
}
}
ajaxreq.onreadystatechange=function() {
if (ajaxreq.readyState==4) {
document.getElementById('checkid').innerHTML=ajaxreq.responseText; }
}
var loginid=document.getElementById('loginid').value;
var querystring="?loginid="+loginid;
ajaxreq.open("GET","ajaxvalidation.php"+querystring,true);
ajaxreq.send(null);
}
</script>
</head>
<body style="border-style: solid;border-width: 20px;border-color: #808080;padding: 10px;">
<!--<center>-->
<form name="registration" method="post" action="ValidationFailed.php">
<p align="center"><font size="3">Pls fill in the below Registration form.Fields marked with <font color="red">*</font> are Mandatory</font></p>
<br>
<fieldset>
<div style="background-image: url(rb6.jpg);background-repeat: no-repeat;width: 167px;height: 30px;text-align: center;padding: 7px;">
<strong>Account Details</strong></div>
<div>
<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="300" style="background-color: #f5f5f5;padding: 4px;"><strong>Login ID</strong><font color="Red">*</font></td>
<td width="500" style="background-color: #fffafa;padding: 4px;"><input type="text" name="LoginId" id="loginid" value="" size="30" maxlength="40">
<a href="" onclick="checkId()">Check Availability</a></td>
<div id="checkid"></div>
</tr>
</tbody>
</table>
</div>
</fieldset>
</form>
</body>
</html>
My issue is whenever I click on the link,iam redirected to Apache Home Page which says that "If you can see this, it means that the installation of the Apache web server software on this system was successful.Blah Blah"
Is there any configuration to be changed to make ajax working with apache?
Or can anyone point to me if anything is wrong in the above code??
Thanks...
The html+Javascript code for Ajax request object is as follows:
<html>
<head>
<title>Registration Form</title>
<script language="javascript" type="text/javascript">
function checkId() {
var ajaxreq;
try {
ajaxreq=new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e) {
try{ ajaxreq=new ActiveXObject("Msxml2.XMLHTTP"); }
catch(e2) {
try{ajaxreq=new XMLHTTPRequest; }
catch(e3) {
alert('Pls update your Browser to use this feature');
return false; }
}
}
ajaxreq.onreadystatechange=function() {
if (ajaxreq.readyState==4) {
document.getElementById('checkid').innerHTML=ajaxreq.responseText; }
}
var loginid=document.getElementById('loginid').value;
var querystring="?loginid="+loginid;
ajaxreq.open("GET","ajaxvalidation.php"+querystring,true);
ajaxreq.send(null);
}
</script>
</head>
<body style="border-style: solid;border-width: 20px;border-color: #808080;padding: 10px;">
<!--<center>-->
<form name="registration" method="post" action="ValidationFailed.php">
<p align="center"><font size="3">Pls fill in the below Registration form.Fields marked with <font color="red">*</font> are Mandatory</font></p>
<br>
<fieldset>
<div style="background-image: url(rb6.jpg);background-repeat: no-repeat;width: 167px;height: 30px;text-align: center;padding: 7px;">
<strong>Account Details</strong></div>
<div>
<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="300" style="background-color: #f5f5f5;padding: 4px;"><strong>Login ID</strong><font color="Red">*</font></td>
<td width="500" style="background-color: #fffafa;padding: 4px;"><input type="text" name="LoginId" id="loginid" value="" size="30" maxlength="40">
<a href="" onclick="checkId()">Check Availability</a></td>
<div id="checkid"></div>
</tr>
</tbody>
</table>
</div>
</fieldset>
</form>
</body>
</html>
My issue is whenever I click on the link,iam redirected to Apache Home Page which says that "If you can see this, it means that the installation of the Apache web server software on this system was successful.Blah Blah"
Is there any configuration to be changed to make ajax working with apache?
Or can anyone point to me if anything is wrong in the above code??
Thanks...