let lastNews = new XMLHttpRequest(); lastNews.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var myArr = JSON.parse(this.responseText); contentStr = ""; myArr.forEach(function(o){ contentStr += "
"+ o.title +"
"; }); document.getElementById('last_news_js').innerHTML = contentStr; } }; lastNews.open("GET", "/json/last.json", true); lastNews.send();