componentDidUpdate() {
if (this.state.closed === true) {
document.body.classList.add('block-closed')
} else {
document.body.classList.remove('block-closed')
}
}
function doMagic(path) {
$.getJSON(path, function (data) {
$(data).each(function(index, item) {
$('#table').append(
'<tr><td class="col1">'+ item.title01 +'</td><td class="col2">' + item.shopcode + '</td><td> <a href="' + item.link + '">' + item.title + '</a></td><td class="col3">' + item.cost + '</td></tr>'
);
});
});
}
doMagic('/js/db04.json')
doMagic('/js/db05.json')
// или
['/js/db04.json', '/js/db05.json', '/js/db06.json'].forEach(doMagic)