Guest User

Untitled

a guest
Oct 6th, 2018
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. /**
  2. * File: js/api/admin/auth.js
  3. */
  4.  
  5. Admin.authenticated = function(xhr)
  6. {
  7. switch (xhr.response) {
  8. case 'SUC':
  9. break;
  10. default:
  11. break;
  12. };
  13. };
  14.  
  15. Admin.authenticate = function(event)
  16. {
  17. // Stop form from submitting onclick.
  18. event.preventDefault();
  19. // Build the posted data object from forms children.
  20. var email = $('form[name=admin_auth]').find('input[name=email]').val();
  21. var passwd = $('form[name=admin_auth]').find('input[name=password]').val();
  22. // Create the ajax request and handle the response.
  23. $.ajax({
  24. url: '/admin/login.php',
  25. type: 'POST',
  26. dataType: 'JSON',
  27. data: {
  28. username: email,
  29. password: passwd
  30. },
  31. success: Admin.authenticated
  32. });
  33. };
Add Comment
Please, Sign In to add comment