Looking to build a work-around of the following.
$.getJSON(\'myfile.json\', function (data) {
showAll(data);
});
I want to avoid using a we
Simple, fast, but bad for real project solution:
myfile.json
to data.js
(name doesn't matter).var myData = {...your json...}
to your html file.myData
variable from javascript with all data.This solution is bad because you add a new variable in global scope and browser would still make a http request to get this .js file.
Also, If you want to make ajax requests to your local files, you can use http server. Take a look at very simple node js http-server.