Tue Sep 04, 2012 12:17 pm
The program in forum give some error to me can any one help me
The program i used is
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<script language="javascript">
function postRequest(strURL){
var xmlHttp;
if(window.XMLHttpRequest){ // For Mozilla, Safari, ...
var xmlHttp = new XMLHttpRequest();
}
else if(window.ActiveXObject){ // For Internet Explorer
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttp.open('POST', strURL, true);
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.onreadystatechange = function(){
if (xmlHttp.readyState == 4){
ajaxloginupdate(xmlHttp.responseText);
}
}
xmlHttp.send(strURL);
}
function ajaxloginupdate(str){
if(str == "yes"){
alert("Hi , user");
}else{
alert("Login falied try again later");
}
}
function loginajax(){
var username = window.document.loginform.uname.value;
var password = window.document.loginform.pword.value;
var url = "Login.jsp?username=" + username + "&password=" +password ;
postRequest(url);
}
</script>
</head>
<body>
<center>
<div>
<form name="loginform" onsubmit="return loginajax();">
<table border="1" cellspacing="1" cellpadding="1" align ="center">
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>UserName</td>
<td><input type="text" name="uname" value=""/></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="pword" value=""/></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td><input type="button" name="LoginButton" value="Login" onclick="loginajax()"></td>
</tr>
</tbody>
</table>
</form>
</div>
</center>
</body>
</html>
The issue i faced was always display "Login falied try again later"
Fri Sep 07, 2012 12:31 am
it seems your server side doesn't return text "xmlHttp.responseText" equal "Yes".
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.