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"); Â Â } } }
2 Answers
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 :)
0
Thanks for your help, this just for testing on the website