Php Ajax
- From: Mike <ampeloso@xxxxxxxxx>
- Date: Sun, 11 May 2008 17:13:56 -0700 (PDT)
Hello,
I have the following 2 files that I'm trying to get working.
I am coming back to this project after a while and cant seem to figure
out why it isnt working anymore.
Alert("Y") runs but I get a "not implemented" Errror before Alert("X")
will run.
Home.php:(Simple Enough)
<!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" />
<title>Untitled Document</title>
<link href="NCAA.css" rel="style***" type="text/css" />
<script src="selectuser.js"></script>
</head>
<body>
<p> </p>
<p> </p>
<table width="500" border="1" align="center" cellpadding="0"
cellspacing="0" id="mainOne">
<tr>
<td>
<form>
<span class="LoginFont">Username</span>
<label>
<input name="U" type="text" id="U" size="15" />
</label>
<span class="LoginFont">Password</span>
<label>
<input name="P" type="text" id="P" size="15" />
</label>
<label>
<input type="button" name="LoginButton" id="LoginButton"
value="Login" onclick="process(U.value,P.value)" />
</form>
<div id="txtHint"></div>
</td>
</tr>
</table>
</body>
</html>
selectuser.js:
var xmlHttp
function process(a,b)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="http://www.XXXXXXX.com/NCAA/morephp.php"
url=url+"?U="+a+"&P="+b
xmlHttp.onreadystatechange=stateChanged()
alert("X")
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged()
{
alert("Y")
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
test ("ReadyState = 4" )
if (xmlHttp.responseText == "<p>Wrong Username or Password Dufus</
p>")
{
document.getElementById("txtHint").innerHTML=xmlHttp.responseText
}
else window.location = "http://www.XXXXXXX.com/NCAA/Main_Mockup.php"
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
I through alerts in ant it SEEMS like xmlHttp.open might be the
problem but I'm not sure
XXXXXXX is my domain.
.
- Follow-Ups:
- Re: Php Ajax
- From: Janwillem Borleffs
- Re: Php Ajax
- Prev by Date: Re: File uploads - progress reporting gets stuck short of 100%
- Next by Date: How to print normally html code ?
- Previous by thread: PHP Classifieds
- Next by thread: Re: Php Ajax
- Index(es):