Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. function createCORSRequest(method, url){
  2. var xhr = new XMLHttpRequest();
  3.  
  4. if ("withCredentials" in xhr){
  5. xhr.open(method, url, true);
  6. } else if (typeof XDomainRequest != "undefined"){
  7. xhr = new XDomainRequest();
  8. xhr.open(method, url);
  9. } else {
  10. xhr = null;
  11. }
  12.  
  13. return xhr;
  14. }
  15.  
  16. function CallWS(){
  17.  
  18. var request = createCORSRequest("POST","https://**************/gateway.com");
  19. if (request){
  20. request.onload = function(){
  21. var res = request.responseText;
  22. alert(res);
  23. };
  24. request.send();
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement