How to parse a JSON file without web request or web server?

前端 未结 5 846
旧巷少年郎
旧巷少年郎 2021-01-21 21:08

Looking to build a work-around of the following.

$.getJSON(\'myfile.json\', function (data) {
    showAll(data);
});

I want to avoid using a we

5条回答
  •  半阙折子戏
    2021-01-21 21:19

    This would be a 3 step process.

    Move the JSON file into a folder with you other web pages

    In the JSON file, give the obejct a name i.e. var data = {...};

    In the file that you wan to use it just call it with the

提交回复
热议问题