I started learning JSON and Javascript and want to create a very easy project with Apache Cordova. So the HTML code should run on my mobile device.
When trying to access the data from the JSON file
{
"test": [
{
"number": 9,
"name": "testObject1",
"types": "death, fire",
"locations": "forest",
"evolesAt": 2,
"evolvesTo": "testGen"
},
{
"number": 28,
"name": "testObject2",
"types": "poison",
"locations": "graveyard",
"evolesAt": 54,
"evolvesTo": "endboss"
}
]
}
by using this code (the json file is on the same directory level as the javascript code)
$.getJSON("TestDatabase.json", function (json) {
console.log(json);
});
the console says
Failed to load file:///.../TestDatabase.json: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
So do I have to install nodeJS for the mobile device? Do I have to use a different data format (means no JSON)?
Currently I just got some HTML, CSS and Javscript/Jquery running in my local browser but I want to run the project on my mobile device later on.