So I have referenced Loading local JSON file & load json into variable and tried loading my own json file into a variable that I want to display, but I still seem to get no values to appear. The json file is local/in the same directory. I believe I have not loaded the file correctly. Is there any errors I didn't catch?
I also tried using $.getJSON and the require.js method, and that didn't work either.
Here is my JSON File:
{
"IMax": 16384,
"IMin": 1,
"DynamicRange": 72,
"I50": 16,
"I75": 192
}
Here is my code:
<!DOCTYPE html>
<html>
<head>
<script src="jquery-3.2.1.min.js"></script>
</head>
<body>
<p id="parameterForm"></p>
<script>
//Where the JSON File should be loaded
var json = (function () {
var json = null;
$.ajax({
'async': false,
'global': false,
'url': "Parameters.json",
'dataType': "json",
'success': function (data) {
json = data;
}
});
return json;
})();
document.getElementID("parameterForm").innerHTML = json.IMax;
</script>
</body>
</html>