Ahoi. I have a javascript function which works loading local json files:
function fetchLocal(){
Locs.loadJSON("../js/stations.json", function(doc) {
var response = JSON.parse(doc.responseText);
listModel.clear();
cities = response;
for (var i = 0; i < response.length && i < 2500; i++) {
listModel.append(response[i]);
};
});
}
function loadJSON(file, callback) {
var xobj = new XMLHttpRequest();
//xobj.overrideMimeType("application/json");
xobj.open('GET', file, true);
xobj.onreadystatechange = function () {
if (xobj.readyState === XMLHttpRequest.DONE) {
callback(xobj);
}
};
xobj.open("GET",file)
xobj.send(null);
}
If I use local file(here’s a copy):
https://poetaster.de/cities.json
It works. If I use:
https://poetaster.de/stations.json
it doe not.
Anyone see a problem? Both are valid json. The stations file is bigger…