I stumbled an issue where I'm working on an HTML file that would load a separate json file. The HTML file have JS code in the <script></script> tag and the json file contains an array with some objects. Both HTML and JSON are stored on my hard drive and my HTML will load using a file path to direct to a file on my PC, not a URL across the internet, to the json file, akin to img src tag using a relative path to an image on my PC.
This video: https://www.youtube.com/watch?v=nx8E5BF0XuE told me that due to the CORS policy made the $.ajax to grab the file stored on his PC, a server is required.
I originally tried doing this before being aware of that video:
(async () => {
const List = await (await fetch("FileWithObjects.json")).json()
})()
If I do not want to use a server as well as node.js, do I HAVE TO have the JSON data in the HTML file itself?