Im trying to get some data from the server, but my request returns me this error: Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers in preflight response.
I tried to solve it, by finding some examples here at stackoverflow, but in my case none of the solutions doesnt seems to work.
Here is my code so far:
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "http://api.admin.wobbl.io/policy/preview?id=41", true);
xhttp.setRequestHeader("Access-Control-Allow-Origin", "*");
xhttp.setRequestHeader("Access-Control-Allow-Credentials", "true");
xhttp.setRequestHeader("Access-Control-Allow-Methods", "GET,HEAD,OPTIONS,POST,PUT");
xhttp.setRequestHeader("Access-Control-Allow-Headers", "Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers");
xhttp.send();
What could be a problem?