Guest User

Untitled

a guest
May 29th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. let xhr = new XMLHttpRequest();
  2. xhr.open("POST", url, true);
  3. xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  4. xhr.onreadystatechange = () => {
  5. if (xhr.readyState == 4) {
  6. if (xhr.status == 200) {
  7.  
  8. resolve(JSON.parse(xhr.responseText));
  9. } else {
  10.  
  11. reject(xhr.responseText);
  12. }
  13. }
  14. };
  15. xhr.send('username=lala&password=lala');
  16.  
  17. xhr.send('username=lala&password=lala');
Add Comment
Please, Sign In to add comment