var jqry = document.createElement('script');
jqry.src = "https://code.jquery.com/jquery-3.3.1.min.js";
document.getElementsByTagName('head')[0].appendChild(jqry);
$.ajax({
url: "http://localhost:7474/bsuapi/",
success: (data) => {
el = $("<div style='with:100%;display:flex'>");
for (topic in data.topics) {
tContain = $("<div>");
tContain.append($("<h3>"+ topic +"</h3>"));
for (idx in data.topics[topic]) {
entry = data.topics[topic][idx];
entryID = "el"+topic+idx;
t = $("<div id='"+entryID+"'>");
t.append($("<h5>"+ entry.name +"</h5>"));
if (entry.smallImage) {
img = $("<img />").attr('src', entry.smallImage).on('load', function() {
if (this.complete && typeof this.naturalWidth != "undefined" && this.naturalWidth != 0) {
$("#"+entryID).append(img);
}
});
}
tContain.append(t);
}
}
console.log(el);
$("body").append(el);
},
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic " + btoa("neo4j:d0wnstr34m"));
}
});