Answer the question
In order to leave comments, you need to log in
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin'?
What kind of magic is this?
I make an ajax request to the server, I get an error
XMLHttpRequest cannot load https://site.com/api. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
xhr.open('POST', 'https://site.com/api', true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send('entityId='+params);
xhr.open('POST', 'https://site.com/api', true);
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xhr.send(params);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question