<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="style.css"> <script src="login.js"></script> <title>Login</title> </head> <body> <form id="loginform"> <div> <p id="insertinfo">Type your info to log in your account:</p> <label for="Username">Username:</label> <input type="text" id="username" placeholder="Type your username"/> </div> <div> <label for="password">Type password:</label> <input type="text" id="password" placeholder="Type your password"/> </div> <div class="loginButton"> <input type="submit" value="Log in" id="loginbutton" onClick = "callServer()" /> </div> </body> </html>
function callServer(){ var username = document.getElementById("username").value; var password = document.getElementById("password").value; var xmlString = "<profile>" + "<username>" + escape(username) +"</username>" + "<password>" + escape(password) +"</password>" + "</profile>"; // Build the URL to connect to var url = "http://localhost:8080/item.xml"; // Open a connection to the server xmlHttp.open("POST", url, true); // Tell the server you're sending it XML xmlHttp.setRequestHeader("Content-Type", "text/xml"); // Set up a function for the server to run when it's done xmlHttp.onreadystatechange = confirmUpdate; // Send the request xmlHttp.send(xmlString); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)