Hello,
I’m trying to send data to my Arduino UNO. The GET method works perfectly fine, but the PUT method returns ‘has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: It does not have HTTP ok status.’ error.
This is an XMLHttpRequest in HTML.
var request = new XMLHttpRequest();
request.open('PUT', 'http://blynk-cloud.com/xxxxxxx/update/V0');
request.setRequestHeader('Content-Type', 'application/json');
request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log('Status:', this.status);
console.log('Headers:', this.getAllResponseHeaders());
console.log('Body:', this.responseText);
}
};
var body = [
255,
0,
0
];
request.send(JSON.stringify(body));
Thank you