CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Ajax and Design (http://www.codingforums.com/forumdisplay.php?f=55)
-   -   how to solve this problem (http://www.codingforums.com/showthread.php?t=272719)

gold_flake 09-10-2012 09:11 AM

how to solve this problem
 
hi......i am facing problem in my this code......please can somebody solve it......here this ajax code is not working....please solve the problem



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript" type="text/javascript" >
function FieldBlank()
{
if(document.getElementById('t1').value=="")
{
alert("Username is required");
return false;
}
if(document.getElementById('t2').value=="")
{
alert("Password is required");
return false;
}

}
</script>
<script type="text/javascript">
function login()
{
var username= document.getElementById('t1').value;
var pass =document.getElementById('t2').value;
var url="password.php?userid="+username+"&pass="+pass;

if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
if(xmlhttp.responseText=="ok"){
window.location="adminpanel.php?user="+username;
}
if(xmlhttp.responseText=="no"){
document.getElementById('errormsg').innerHTML="Please check the username & password again!!!";
setTimeout("document.getElementById('errormsg').style.display='none';",3000);
document.getElementById('t2').value="";

}
}
}
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
</script>
<style type="text/css">
.box {
background-attachment:initial;
background-clip:initial;
background-color:#F5F5F5;
background-image:initial;
background-origin:initial;
border-bottom-color:#E5E5E5;
border-bottom-style:solid;
border-bottom-width:1px;
border-left-color:#E5E5E5;
border-left-style:solid;
border-left-width:1px;
border-right-color:#E5E5E5;
border-right-style:solid;
border-right-width:1px;
border-top-color:#E5E5E5;
border-top-style:solid;
border-top-width:1px;
margin-bottom:156px;
margin-left:284px;
margin-right:284px;
margin-top:236px;
padding-bottom:15px;
padding-left:25px;
padding-right:25px;
padding-top:20px;

}
.link{
background-color:red;
background-image:-webkit-linear-gradient(top, red, red);
border-bottom-color:red;
border-bottom-style:solid;
border-bottom-width:1px;
border-left-color:red;
border-left-style:solid;
border-left-width:1px;
border-right-color:red;
border-right-style:solid;
border-right-width:1px;
border-top-color:red;
border-top-style:solid;
border-top-width:1px;
color:#FFFFFF;
text-shadow:rgba(0, 0, 0, 0.0976563) 0 1px;
}
</style>
</head>

<body>
<div id="main" align="center" class="box">
<form action="" method="post" name="faq" onsubmit="FieldBlank();" >
<table width="234">
<tr>
<td height="49" colspan="3" align="center"><solid> ADMIN LOGIN</solid>&nbsp;</td>
</tr>
<tr>
<td width="75">Username</td>
<td width="146">
<input type="text" name="userid" id="t1" />
</td>
<td width="1">&nbsp;</td>
</tr>
<tr>
<td>Password</td>
<td>
<input type="password" name="pass" id="t2" />
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><input name='button' type='button' class="link" id='Submit' value='Submit' onclick="login();" /></td>
<td><a href="changepassword.php">Change password</a></td>
<td></td>
</tr>

<tr>
<td height="23" colspan="3">&nbsp;</td>
</tr>
</table>
</form>
<div id="errormsg"></div>
</div>

</body>
</html>

devnull69 09-10-2012 12:35 PM

What is your problem? What is your question?

WolfShade 09-10-2012 01:36 PM

Access directly the page being called via AJaX using the URL parameters. Is the page erroring?

^_^


All times are GMT +1. The time now is 07:13 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.