Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function clicked()
- {
- console.log("Hello Wrld!");
- if(typeof XMLHttpRequest!="undefined")
- {
- var xmlhttp = new XMLHttpRequest;
- }
- else
- {
- console.log("Undefined");
- }
- xmlhttp.onreadystatechange = function (){
- //response received in this function
- console.log("Got inside respone");
- console.log(xmlhttp.readyState);
- if(xmlhttp.readyState==4)
- {
- console.log("Got inside actual response");
- console.log(xmlhttp.responseText);
- }
- }
- console.log("Got here by json data");
- var json_data = {"username" : "Joe"};
- xmlhttp.open("POST","http://localhost:8080/alpha/welcome.php",true);
- xmlhttp.setRequestHeader("Content-type","application/json");
- //xmlhttp.setRequestHeader("content-length", json_data.length);
- //xmlhttp.setRequestHeader("connection", "close");
- xmlhttp.send(json_data);
- var username = document.getElementById('username');
- var password = document.getElementById('password');
- var detUser = "Unknown";
- var detPassword = "Unknown";
- if(username.value == detUser && password.value == detPassword)
- {
- console.log("Made it to first if");
- //alert("Login Successful");
- }
- else if(username.value == detUser)
- { console.log("1");
- //alert("Username is right at least");
- }
- else if(password.value == detPassword)
- {
- console.log("2");
- //alert("Password is right at least");
- console.log("Password is " + password.value);
- }
- else
- {
- //alert("Inccorrect user info, try again.");
- }
- }
Add Comment
Please, Sign In to add comment