This is my app.js file
$(document).ready(function () {
$.getJSON("http://localhost:3000/db.json", function (data) {
$(data.as).each(function (index, value) {
console.log(value);
});
});
});
and this is db.json file
{
"as": [
{
"imageID": "1",
"imageSource": "Popular Science 1",
"alt": "Science 1"
},
{
"imageID": "2",
"imageSource": "Popular Science 2",
"alt": "Science 2"
}
]
}
How to get only, for example, Popular Science 2?
if I write console.log(value[1]);, an error is displayed. How to index an array?