Advertisement
Guest User

Untitled

a guest
Jan 11th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. $(function() {
  2. $('#login').click(function(){
  3. authentificationService("login");
  4. });
  5. $('#register').click(function(){
  6. authentificationService("register");
  7. });
  8. $('#list').click(function(){
  9. $.ajax({
  10. url: '/room',
  11. type: 'GET',
  12. data: {
  13. "do":"list"
  14. },
  15. success: function(response){
  16. $('#list-result').empty();
  17. $('#list-result').append(response);
  18. $('#list-result').show();
  19. },
  20. error: function(){
  21. $('#401').show();
  22. }
  23. });
  24. });
  25. });
  26. function authentificationService(service){
  27. var username = $('#username').val();
  28. var password = $('#password').val();
  29. $.ajax({
  30. url: '/auth',
  31. type: 'POST',
  32. data: {
  33. "service": service,
  34. "username": username,
  35. "password": password
  36. },
  37. success: function(){
  38. console.log("Everything went fine");
  39. $('#authentification').hide();
  40. $('#choice').show();
  41. },
  42. error: function(){
  43. $("*").hide;
  44. $('#505').show();
  45. }
  46. });
  47. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement