I\'m trying to load a local JSON file but it won\'t work. Here is my JavaScript code (using jQuery):
var json = $.getJSON("test.json"); var data = e
In a more modern way, you can now use the Fetch API:
fetch("test.json") .then(response => response.json()) .then(json => console.log(json));
All modern browsers support Fetch API. (Internet Explorer doesn't, but Edge does!)
source:
Using Fetch
Fetch in Action
Can I use...?