Total members 11895 |It is currently Sun Dec 22, 2024 9:57 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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"




Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time

it seems your server side doesn't return text "xmlHttp.responseText" equal "Yes".

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Issue in ajax
 Word & ASP.Net ISSUE     -  
 Datepicker issue with Internet Explorer     -  
 how to issue the command of Ctrl-C in Java     -  
 Javascript select menu validation issue     -  
 Crystal report export to excel, page header issue asp.net     -  
 solving dojox/mobile/Heading moveTo function bug issue     -  
 What is AJAX, How to start AJAX?     -  
 need help in ajax     -  
 AJAX WITH JSP     -  
 using ajax with asp     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
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