justinh Posted January 20, 2009 Share Posted January 20, 2009 <html> <head> <script language="javascript" type="text/javascript"> var request = false; try { request = new XMLHttpRequest(); } catch (trymicrosoft) { try { request = new activeXObject("Msxml2.XMLHTTP"); } catch (tryothermicrosoft) { try { request = new activeXObject("Microsoft.XMLHTTP"); } catch (failed) { request = false; } } } if(!request){ alert("Error intializing XMLHTTP"); } function logIn(){ var username = document.getElementById("username").value; var password = document.getElementById("password").value; var url = "checklogin.php?username=" + escape(username) + "&password=" + escape(password); request.open("GET", url, true); request.onreadystatechange = updatePage; request.send(null); } function updatePage(){ if(request.readyState == 4){ if(request.status == 200){ document.getElementById("status").innerHTML = request.responseText; }else{ [b] alert("Error! " + request.status); [/b] } } } </script> </head> <body> <form> <div id="status"></div> <label for="username">Account Name </label><input type="text" name="username" id="username" onkeyUp="logIn();" /> <label for="password">Password </label><input type="password" name="password" id="password" onkeyUp="logIn();"/> </form> </body> </html> Not sure why, but the error is only returned when I type fast lol.. I'm just learning, so please be nice. Link to comment https://forums.phpfreaks.com/topic/141616-requeststatechange-maybe/ Share on other sites More sharing options...
justinh Posted January 20, 2009 Author Share Posted January 20, 2009 ugh this is the wrong forum, could a mod please move it =/ Link to comment https://forums.phpfreaks.com/topic/141616-requeststatechange-maybe/#findComment-741253 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.