Hello,
I have a question. I am trying to fetch some data from InfluxCloud service with fetch function from JavaScript. Somehow I am able to do it on localhost, but not on InfluxCloud Server. The response that I am getting is:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://earthangel-ed2e3506.influxcloud.net:8086/query?pretty=true&db=test&q=SELECT%20*%20FROM%20data2000. (Reason: expected ‘true’ in CORS header ‘Access-Control-Allow-Credentials’).
and my fetch function looks like this:
var query = “SELECT * FROM data2000”
fetch(“https://earthangel11111.influxcloud.net:8086/query?pretty=true&db=test&q=”+query, {
method: ‘GET’,
credentials: ‘include’,
}).then(function(response) {
response.json().then(function(data) {
jsonObject = data.results[0].series;
})
}).catch(function(err) {
console.log(err)
console.log(“JSON Object not able to be fetched from InfluxDB”)
})
Can anyone please help me?
Kind best regards!
Mile