daily pastebin goal
65%
SHARE
TWEET

Untitled

xuio Apr 27th, 2016 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fetch('/api/v1/auth', {
  2.             method: 'POST',
  3.             headers: {
  4.                 'cache-control': 'no-cache',
  5.                 'content-type': 'application/x-www-form-urlencoded',
  6.             },
  7.             body: {
  8.                 username: "user",
  9.                 password: "pass"
  10.             }
  11.         })
  12.  
  13. var data = "username=test123&password=test123";
  14.  
  15. var xhr = new XMLHttpRequest();
  16.  
  17. xhr.open("POST", "/api/v1/auth");
  18. xhr.setRequestHeader("cache-control", "no-cache");
  19. xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
  20.  
  21. xhr.send(data);
  22.  
  23. xhr.addEventListener("readystatechange", function () {
  24.   if (this.readyState === 4) {
  25.     console.log(this.responseText);
  26.   }
  27. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top