Created
October 24, 2018 14:29
-
-
Save theCaptain420/daf3990d9c57c7a579eb57c8664ddda2 to your computer and use it in GitHub Desktop.
TSMWIN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function testLogin(){ | |
console.log("prøver at logge ind! ") | |
var brugernavninput = document.getElementById("brugernavn"); | |
var passwordinput = document.getElementById("password") | |
//console.log(brugernavninput.value +" - "+passwordinput.value); | |
//document.getElementById("skrivher").innerHTML = "knap klikket"; | |
var params = 'brugernavn='+brugernavninput.value+'&password='+passwordinput.value+''; | |
var xmlhttp = new XMLHttpRequest(); | |
xmlhttp.onreadystatechange = function() { | |
console.log("inde") | |
console.log(this.readyState+" "+this.status) | |
if (this.readyState == 4 && this.status == 200) { | |
if(this.response=="fejl") { | |
alert("wrong info, you have lost your asian") | |
}else{ | |
window.location.href= "http://127.0.0.1:5500/menuside.html" | |
document.cookie="loginId="+this.response+"" | |
//alert(document.cookie) | |
} | |
document.getElementById("skrivher").innerHTML = this.response; | |
} | |
}; | |
var url = "http://172.20.10.2:3000/login"; | |
xmlhttp.open("POST", url, true); | |
xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); | |
xmlhttp.send(params); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | |
<title>Bingo</title> | |
<link rel="stylesheet" href="style3.css"> | |
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"> | |
<script src="logintoServer.js"></script> | |
</head> | |
<body> | |
<main id="main"> | |
<section id="section-a"> | |
<div class="container"> | |
<input id = "brugernavn" type="email" placeholder="Email" name="uname" required> | |
<input id = "password" type="password" placeholder="Kodeord" name="psw" required> | |
<div> | |
<button onclick="testLogin()">Log Ind</button> | |
<p id="skrivher"> </p> | |
</div> | |
</div> | |
<div class="container2"> | |
<button class="lgnsocialbtn" type="submit">Facebook - Log Ind</button> | |
<button class="lgnsocialbtn" type="submit">Google - Log Ind</button> | |
<div> | |
<a href="nyBruger.html"></a><button type="submit">Opret Ny bruger</button> | |
</div> | |
</div> | |
</section> | |
</main> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment