0

What do we need to make full http request

var data=[]; function loadDoc(){ var req= new XMLHttpRequest(); const proxyurl = "https://cors-anywhere.herokuapp.com/"; const url = "demo_post2.asp"; // site that doesn’t send Access-Control-* fetch(proxyurl + url); console.log(req); req.open("GET","demo_post2.asp"); req.send(); req.onreadystatechange=function(){    if(this.readyState==4 && this.status==200){      var myData=JSON.parse(req.responseText);      document.getElementById("demo").innerHTML=myData;    }else{      console.log("error");    } } }

29th Apr 2020, 11:15 AM
Mamdouh
2 odpowiedzi
0
You'll be advised to add "cors-anywhere" to the questions tags: you'll get more probabilities to find someone who could answer better than me... ... because I have never used this kind of service, so, all I can say is that if targeted "site doesn't send Access-Control-*", it's meaning that they doesn't allow external API call (maybe things as cors-antwhere could workaround that, but you must be aware that's sounds quite illegal or at least irrespectuous ^^). It's just my point of view ;P You're probably a big boy, it's up to you to decide what to do or not to do :)
29th Apr 2020, 11:50 AM
visph
visph - avatar
0
Thanks for your help, this just for testing on the website
29th Apr 2020, 12:11 PM
Mamdouh