Just a small disclaimer: I only have basic knowledge of JS and I'm just starting to learn it, so my code might be really stupid.
I want to take the contents of a .JSON file and assign every entry to a separate JS variable. I am running a local server to be able to read the files as (if I understood this correctly) Chrome would prevent me from accessing local files due to their policy.
Here's the JSON file contents:
{
    "current" : "current_value",
    "voltage" : "current_voltage"
}
And here's my JS script (again this is 100% dumb code as I'm just starting out)
<script src="/jquery-3.5.1.min.js"></script>
<script>
    var data = $.getJSON("localhost:8888/data.json", function(json){
        console.log(json);
        var current = json.current;
    });
    alert(current);
</script>
Here's the File Structure:
L main.html
L jquery-3.5.1.min.js
L data.json
What I want to do is to take the value of current in the .JSON file and assign it to the current JS variable. Basically this would be used to have a local web interface to check the real time voltage and current of a battery.
Thank you for taking your time to read this,
Huky
