123456789101112131415161718192021222324252627282930313233343536 |
- <html>
- <head>
- <title>Login</title>
- <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
- </script>
- </head>
- <body>
- <h1>Create an account!</h1>
- <p>Username:</p>
- <input id="username" type="text">
- <p>Password:</p>
- <input id="password" type="password">
- <br>
- <br>
- <button onclick="handleCreate()">Create</button>
-
- <script>
- function handleCreate() {
- var username = $("#username").val();
- var password = $("#password").val();
- $.ajax({
- url: "/signup",
- data: {username: username, password: password},
- success: function(value){
- if (value == "success"){
- alert("Sucess! Your account is created!");
- }else{
- alert("ERROR: The username has already been used!");
- }
- }
- });
- }
- </script>
- </body>
- </html>
|