Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. var url = "https://api.outpan.com/v1/products/0796435419035";
  2. var xmlhttp = new XMLHttpRequest();
  3. var encodedString = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
  4. xmlhttp.open("GET", url, true);
  5.  
  6. xmlhttp.setRequestHeader("Authorization", "Basic" + encodedString);
  7. xmlhttp.send();
  8. var temp = xmlhttp.responseXML;
  9.  
  10. {
  11. "error": {
  12. "code": 1000,
  13. "message": "Authentication is required."
  14. }
  15. }
  16.  
  17. Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
  18.  
  19. xmlhttp.setRequestHeader("Authorization", "Basic " + encodedString);
  20.  
  21. var temp = xmlhttp.responseXML;
  22.  
  23. xmlhttp.onreadystatechange = function () {
  24. if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
  25. var response = xmlhttp.responseText;
  26. console.log(response);
  27. }
  28. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement