logout.html 773 B

123456789101112131415161718192021222324252627282930
  1. <html>
  2. <head>
  3. <title>Logout</title>
  4. <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
  5. </script>
  6. </head>
  7. <body>
  8. <button onclick="handleLogout()">Click to Logout!!!!!!!!</button>
  9. <script>
  10. function handleLogout() {
  11. var username = window.location.hash.substring(1);
  12. alert(username+" is logging out......")
  13. $.ajax({
  14. url: "/logout",
  15. data: {username: username},
  16. success: function(value){
  17. var response = JSON.parse(value)
  18. if (response.LoggedOut == true){
  19. alert(username+" logged out successfully");
  20. window.location.href = '/login.html';
  21. }else{
  22. alert("Error: logged out failed!");
  23. }
  24. }
  25. });
  26. }
  27. </script>
  28. </body>
  29. </html>`