signup.html 928 B

123456789101112131415161718192021222324252627282930313233343536
  1. <html>
  2. <head>
  3. <title>Login</title>
  4. <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
  5. </script>
  6. </head>
  7. <body>
  8. <h1>Create an account!</h1>
  9. <p>Username:</p>
  10. <input id="username" type="text">
  11. <p>Password:</p>
  12. <input id="password" type="password">
  13. <br>
  14. <br>
  15. <button onclick="handleCreate()">Create</button>
  16. <script>
  17. function handleCreate() {
  18. var username = $("#username").val();
  19. var password = $("#password").val();
  20. $.ajax({
  21. url: "/signup",
  22. data: {username: username, password: password},
  23. success: function(value){
  24. if (value == "success"){
  25. alert("Sucess! Your account is created!");
  26. }else{
  27. alert("ERROR: The username has already been used!");
  28. }
  29. }
  30. });
  31. }
  32. </script>
  33. </body>
  34. </html>