Related question.
I am trying to send a POST request to an API for testing purposes. I keep getting
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '{my local IP}' is therefore not allowed access. The response had HTTP status code 403.
Here is the relevant code:
function searchSimilar2(){
var base_url = "{request url}"
var send_url = base_url + "{inline arguments}"
var params = '{"size":10, "mediaUrl":"https://cdn.yoox.biz/39/39706632kh_20_f.jpg2"}'
function func(){
console.log(this.response)
}
var hReq = new XMLHttpRequest();
hReq.open('POST', send_url)
hReq.setRequestHeader('Content-Type', 'application/json')
hReq.onload = func;
hReq.send(params)
I omitted the request url and arguments, since I know the problem is not with them.
As per the linked questions answers, I am not using JQuery, and I am running a python SimpleHTTPServer where I am sending this request from. I keep getting this error.