I have the following JavaScript/jQuery code:
setInterval(function() {
$.getJSON('../0.json', function(json) {
alert("piep");
$.each(json, function(k, v) {
$('.' + k).text(v.value);
});
});
}, 1000);
As you see, I'm trying to get a local JSON file and do something with it. To check whether the .getJSON function works, I let it alert me. Which is in fact the problem: it does not alert.
Currently, the page is static, but was part of a Sinatra app. In the app it got it from
'/0.json'
as the server served it thusly, and it worked.
Hence, I'm infering it having something to do with the "staticness" of the HTML page and the local JSON file.
Is it even possible to get local JSON files?
EDIT: The JSON file being a local one, the access is being forbidden by the browser.