i have html file with javascript, app for driving tests and 2 json files: Categories of name of test and questions with answer it self. this json is dump of sqlite database. example output below.
[
{
"cat_id": "1",
"cat_name": "Общие понятия",
"cat_score": "2"
},
{
"cat_id": "2",
"cat_name": "Обязанности водителя",
"cat_score": "7"
},
{
"cat_id": "3",
"cat_name": "Cостояние здоровья водителя",
"cat_score": "1"
}
]
in my engine.js everything works but my questions and categories files are not loaded. i don't know how to load then and parse to array or variable to use it in script.
for example in php i have
require and include or file_get_content but how i need to load
So i found how to load but it not working
function load() {
var someData_notJSON = JSON.parse(data);
console.log(someData_notJSON);
}
my html file is
<script type="text/javascript" src="./Categories.json"></script>
<script type="text/javascript" src="./Questions.json"></script>