Guest User

Untitled

a guest
Aug 15th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <system.webServer>
  2. <httpProtocol>
  3. <customHeaders>
  4. <add name="Access-Control-Allow-Origin" value="*"/>
  5. <add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS"/>
  6. <add name="Access-Control-Allow-Headers" value="Content-Type"/>
  7. </customHeaders>
  8. </httpProtocol>
  9. </system.webServer>
  10.  
  11. var data = null;
  12. var xhr = new XMLHttpRequest();
  13. xhr.withCredentials = false;
  14.  
  15. xhr.addEventListener("readystatechange", function () {
  16. if (this.readyState === 4) {
  17. console.log(this.responseText);
  18. }
  19. });
  20.  
  21. xhr.open("POST","ur here");
  22. xhr.setRequestHeader("Content-Type", "application/json");
  23. xhr.setRequestHeader("Cache-Control", "no-cache");
  24. xhr.setRequestHeader("Authorization", "Basic " + btoa("demo:demo"));
  25.  
  26. xhr.send(data);
Add Comment
Please, Sign In to add comment