Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. $(document).ready(function() {
  2. $("#login").click(function() {
  3. var username = $("#username").val();
  4. var password = $("#password").val();
  5. $.ajax({
  6. url: "https://myanimelist.net/api/account/verify_credentials.xml",
  7. type: "GET",
  8. dataType: "XML",
  9. beforeSend: function(xhr) {
  10. xhr.setRequestHeader("Authorization", "Basic" + btoa(username + ":" + password));
  11. }
  12.  
  13. })
  14. .done(function() {
  15. $("#loginForm").css("display", "none");
  16. $("#msg").css("visibility", "visible");
  17. $("#msg").text("Successfully logged in.");
  18. })
  19. .fail(function() {
  20. $("#msg").css("visibility", "visible");
  21. $("#msg").text("Failed to log in.");
  22. });
  23. });
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement