I am practicing with the realization of an app with Cordova I have to read a txt file located on a server but when I try to make the XMLHttpRequest request it gives me this error:
from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
var xhttp = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP");
xhttp.open("GET", "https://www.radiomatese.it/txt/data.txt", true);
xhttp.onreadystatechange = function() {
alert("1");
if (xhttp.readyState == 4) {
alert("2");
let data = xhttp.responseText;
alert(data);
}
}
xhttp.send();