Guest User

Untitled

a guest
Mar 13th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="US-ASCII">
  5. <title>Login Page</title>
  6. <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
  7.  
  8. </head>
  9. <body>
  10. <h3>Login with email and password</h3>
  11. <form id="testForm" action="login" method="post">
  12. <strong>User Email</strong>:<input type="text" name="email" id="email"><br>
  13. <strong>Password</strong>:<input type="pass" name="pass" id="pass"><br>
  14. <input type="submit" value="Login" id="subForm">
  15. <div id="result"><%=request.getAttribute("email")%></div>
  16. </form>
  17. <br>
  18. If you are new user, please <a href="register.html">register</a>.
  19. </body>
  20. </html>
  21.  
  22. <script>
  23.  
  24. function sendAjax() {
  25.  
  26. var user = new Object();
  27.  
  28. var email = $('#email').val();
  29.  
  30. var pass = $('#pass').val();
  31.  
  32. $.ajax({
  33. url: "localhost:8888/api/login",
  34. type: 'POST',
  35. dataType: 'json',
  36. data: JSON.stringify({"email":email,"pass":pass}),
  37. contentType: 'application/json',
  38. mimeType: 'application/json',
  39.  
  40. success: function (data) {
  41. $("#result").html("email: "+data.email+" pass: "+data.pass)
  42. },
  43. error:function(data,status,er) {
  44. alert("error: "+data+" status: "+status+" er:"+er);
  45. }
  46. });
  47. }
  48. </script>
Add Comment
Please, Sign In to add comment