I've been trying to workout if it's possible for me to get rid of my 'Access-Control-Allow-Origin' error.
I'm requesting data from some reports that come back as CSV files but for them to work i have to use a chrome plug in that disables CORS.
after reading tons of stack over flow questions and lots of googling i still can't tell whether it's something I'm not putting in my code or if it's a setting where the data is stored that needs to turn it on.
here is my code that requests the data, bare in mind this works just only with the plug in and my API key has been removed.
function Getfueltype(){
j=JSON.stringify
$.ajax({
url: 'https://api.bmreports.com/BMRS/FUELINSTHHCUR/v1?APIKey=&ServiceType=CSV',
async: false,
success: function (csvd) {
data = $.csv.toArrays(csvd);
},
dataType: "text",
complete: function () {
while (n < (data.length)-2) {
fueltype = j( data[n].slice(1,2));
GigaWatt = j(parseFloat(data[n].slice(2,3)));
arr.push(fueltype);
arr2.push(GigaWatt);
n++
}
drawChart2(data);
}
});
}