I wrote a simple JS Helper Script for interfacing with the API, however the script is unable to access data returned from the API due to missing CORS headers.
I have exactly the same problem. How can we get the response to a HTTP GET request to avoid the CORS error? I am using a HTML-Javascript and running in Google Chrome
It works for me. But not for a file( For it i have the CORS problem too.
function setTheRadio(value) {
var ip = document.getElementById("ipAddress").value;
const xhr = new XMLHttpRequest();
const url = `http://${ip}/httpapi.asp?command=setPlayerCmd:play:${value}`;
xhr.open('GET', url);
xhr.send();
}
function setPlayer(value) {
var ip = document.getElementById("ipAddress").value;
const xhr = new XMLHttpRequest();
const url = `http://${ip}/httpapi.asp?command=setPlayerCmd:${value}`;
xhr.open('GET', url);
xhr.send();
}