hi,
good morning to everyone
i am beginner in the AJAX programming.
i execute the one ajax program ..but it didn't run properly...the code as given below.
// index.html
<html>
<head><title>Admin Login Page</title>
<script language="javascript" type="text/javascript" src="checkLogin.js">
</script>
</head>
<body>
<br><br><br><br><br><br><br><br><br><br>
<form name="form1" action="adminCredinitial.php">
<table width="303" border="1" align="center" bgcolor="#99CCFF">
<tr>
<td width="160"><div align="center"><strong>Enter AdminName </strong></div></td>
<td width="165"><input type="text" name="name"></td>
</tr>
<tr>
<td><div align="center"><strong>Enter Password </strong></div></td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="submit" value="Submit" onClick="check_Login();">
</div></td>
</tr>
</table>
<div id="resultText">
</div>
</form>
</body>
</html>
//----------------------------------------------------------------------------------------------------------------------------
// JavaScript Document
//checkLogin.js
function createRequestObject(){
var request_o;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_o = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_o = new XMLHttpRequest();
}
return request_o;
} //end of function createRequestObject()
var http = createRequestObject();
function check_Login(){
http.open('get','adminCredintial.php?adminName='+document.form1.name.value+'&adminPassword='+document.form1.password.value);
http.onreadystatechange = handleMessage;
http.send(null);
} //end of function chekc_Login()
function handleMessage(){
if(http.readyState==4){
var response=http.responseText;
document.getElementById('resultText').innerHTML = response;
return false;
}
} //end of function handleMessage()
//--------------------------------------------------------------------------------------------------
<!-- adminCredintial.php -->
<?php
$adminName="";$adminPassword="";
if(isset($_GET)) {
$adminName=$_GET['adminName'];
$adminPasssword=$_GET['adminPassword'];
}
if($adminName=='admin' && $adminPassword=='admin') {
echo "You are a valid member";exit;
}
else {
echo "You are not a valid member";
}
?>
//------------------------------------------------------------------------
plz give the reply about the above code...
regards
--------
ran_php
Problem on Simple AJAX Program(Please give the reply)
Started by ran_php, Mar 03 2006 05:50 AM
2 replies to this topic
#1
Posted 03 March 2006 - 05:50 AM
#2
Posted 04 March 2006 - 05:14 PM
Hi,
Generally outputting great amount of code into post ensures that nobody cares to go through it, and your question stays unresolved.
Could you please specify what goes wrong, what error messages you get, plus giving us some info regarding how acctually script is supposed to behave (if runs correctly) would ge great.
Thanks,
Torio
Generally outputting great amount of code into post ensures that nobody cares to go through it, and your question stays unresolved.
Could you please specify what goes wrong, what error messages you get, plus giving us some info regarding how acctually script is supposed to behave (if runs correctly) would ge great.
Thanks,
Torio
#3
Posted 23 December 2009 - 11:13 AM
hello,
firstly <form> tah has no method specified.
you should use POST method in it and access parameters by $_POST['param'].
others are working fine.
firstly <form> tah has no method specified.
you should use POST method in it and access parameters by $_POST['param'].
others are working fine.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users













