Answer the question
In order to leave comments, you need to log in
How to access local JSON file?
There is an HTML page that needs to be filled with data from a JSON file located on the same machine.
I'm trying to get data using
but the browser console swears: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. .
How can I get data from 'storage.json'?
$.getJSON('storage.json');
Answer the question
In order to leave comments, you need to log in
Google "File Access" and "Filesystem API"
You can start from here www.html5rocks.com/ru/features/file_access
and from here www.html5rocks.com/ru/tutorials/file/dndfiles
Try to use some kind of web server to get a json file from a URL like
localhost/storage.json
if the page is loaded from the url //localhost/index.html - you can get it like this$.getJSON('/storage.json');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question