Advertisement
fahmihilmansyah

javasc

Jun 22nd, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.83 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <meta charset="utf-8">
  5.   <title></title>
  6.   <script src="https://code.jquery.com/jquery-3.0.0.min.js" type="text/javascript" ></script>
  7. </head>
  8. <body>
  9.  
  10. <h2>AJAX</h2>
  11. Nama<br />
  12. <input type="text" id="name" name="name" /><br />
  13. Password<br />
  14. <input type="password" id="password" name="password" /><br />
  15. <button type="button"  id="loadings">Request data</button>
  16.  
  17. <p id="demo"></p>
  18.  
  19. <script>
  20. $(document).ready(function(){
  21.   $("#loadings").on("click",function(){  
  22.     $.ajax({
  23.       url:"http://103.28.119.20:8080/SecurityApi/system/login",
  24.       type:"POST",
  25.       data:btoa($("#name").val() + ":" + $("#password").val() ),
  26.       contentType:"application/json; charset=utf-8",
  27.       dataType:"json",
  28.       success: function(msg){ alert(msg) }
  29.     });
  30.  
  31. </script>
  32.  
  33. </body>
  34. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement