Advertisement
Guest User

Untitled

a guest
May 9th, 2017
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. $(function() {
  2.  
  3. $("#login_btn").click(function() {
  4.  
  5.  
  6. var username = $("#username").val();
  7. var password = $("#password").val();
  8.  
  9. $("#login_btn").hide();
  10.  
  11. $.ajax({//AJAX request
  12. type: "post",
  13. url: "https://URL.com/function_app/test.php",
  14. cache: false,
  15. async: true,
  16. data: {username: username, password: password},
  17. dataType: 'json', // You have to add this line
  18. success: function (data) {
  19.  
  20. alert("works");
  21. $("#login_message").html(data.result);
  22. $("#login_btn").show();
  23.  
  24. },
  25.  
  26. error: function (data) {
  27.  
  28. alert( "Request failed: " + data.result );
  29. $("#login_btn").show();
  30.  
  31. }
  32.  
  33. });
  34.  
  35. });
  36.  
  37. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement