Advertisement
gersy

Untitled

Feb 13th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. </script>
  2.  
  3. function readBody(xhr) {
  4. var data;
  5. if (!xhr.responseType || xhr.responseType === "text") {
  6. data = xhr.responseText;
  7. } else if (xhr.responseType === "document") {
  8. data = xhr.responseXML;
  9. } else {
  10. data = xhr.response;
  11. }
  12. alert(data);
  13. return data;
  14. }
  15.  
  16. var xhr = new XMLHttpRequest();
  17. xhr.onreadystatechange = function() {
  18. if (xhr.readyState == 4) {
  19. console.log(readBody(xhr));
  20. }
  21. }
  22. xhr.open('POST', '/buzzfeed/_www_login', true);
  23. xhr.send(null);
  24.  
  25. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement