Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-10-2012, 09:11 AM   PM User | #1
gold_flake
New to the CF scene

 
Join Date: Sep 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
gold_flake is an unknown quantity at this point
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>
gold_flake is offline   Reply With Quote
Old 09-10-2012, 12:35 PM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
What is your problem? What is your question?
devnull69 is offline   Reply With Quote
Old 09-10-2012, 01:36 PM   PM User | #3
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 941
Thanks: 7
Thanked 95 Times in 95 Posts
WolfShade is an unknown quantity at this point
Access directly the page being called via AJaX using the URL parameters. Is the page erroring?

^_^
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
WolfShade is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:28 AM.


Advertisement
Log in to turn off these ads.