I'm looking to get the content of a text file in Javascript to parse it after. I know how to do it with Jquery, i used to call the ajax function with JSONP, but, this time i would like to do it without any framework.
I did code a lot of try but nothing succeed. Here is the last version :
var url = 'https://url.com/videosList.txt';
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = process;
xhr.open("GET", url, true);
xhr.send();
function process()
{
if (xhr.readyState == 4) {
console.log(xhr.responseText);
}
}
The code seems to be ok but my browser (chromium) returns me :
> XMLHttpRequest cannot load
> https://url.com/videosList.txt. Origin
> http://localhost:8888 is not allowed by Access-Control-Allow-Origin.