$(function () { var json = ""; var client = new XMLHttpRequest(); client.open('GET', '/WebGoat/lesson_js/questions.json'); client.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { json += client.responseText; console.log("entry"); let questionsJson = json; var questionsObj = JSON.parse(questionsJson); let html = ""; jQuery.each(questionsObj, function(i, obj) { jQuery.each(obj, function(j, quest) { html += "

" + (j+1) + ". " + quest.text + "

"; html += "
"; jQuery.each(quest.solutions, function(k, solution) { solution = "Solution " + k + ": " + solution; html += '' + solution + '
'; }); html += "
"; }); }); document.getElementById("q_container").innerHTML = html; } } client.send(); });