Closed dren39 closed 4 years ago
Hello I just tested CORS config and was able to successfully call the api from my localhost website. Here is my code sample.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$.ajax({
type: "GET",
url: "https://api.smartable.ai/coronavirus/stats/US",
// Request headers
beforeSend: function(xhrObj) {
xhrObj.setRequestHeader("Cache-Control", "no-cache");
xhrObj.setRequestHeader("Subscription-Key", "<replace this with your own key>");
},
})
.done(function (data) {
alert(data.updatedDateTime);
})
.fail(function () {
alert("error");
});
</script>
Could you please try again? It will be helpful if you can share repro steps.
Hi, I just tested it with a GET request using fetch and it looks like it's working again. Not sure what was wrong with yesterday, I even tried making a request using the demo on the SmartableAI website and was getting the CORS error. Thanks for taking a look at this. I'll go ahead and close this.
Hi, I'm currently trying to access the COVID19 API from a web app from local host, and I seem to be getting the CORS 'Access-Control-Allow-Origin' error. I saw that there was an issue opened back in March, which is now closed, that reported the same error and it seemed to be a server configuration issue. Has the configuration been changed again? Thanks for your time.