Код: Выделить всё
window.test =
{
"header1":
[
{ "title": "title1", "author": "author1"},
{ "title": "title2", "author": "author2"},
{ "title": "title3", "author": "author3"}
],
"header2":
[
{ "title": "title1", "author": "author1"},
{ "title": "title1", "author": "author2"},
{ "title": "title1", "author": "author3"}
]
};
Код: Выделить всё
$(function() {
$.getJSON('jsonFile.js',function(data){
$.each(data, function(){
console.log(header1.title);
console.log(header2.title);
});
});
});
Подробнее здесь: https://stackoverflow.com/questions/100 ... -with-json
Мобильная версия