I am trying to display the first 15 results of my neural network on a web page. However, nothing is showing up on the screen even when I replace results with "HELLO" in the line document.getElementById("results").innerHTML = results;. I am not getting any errors from this code.
<div id="results">
</div>
<script>
var n = 1;
function display_res() {
var results = "";
for (var i = n; i < n + 15; i++) {
results += ("<p class='metadata'>" + JSON.parse({{graph_NN}}['node" + i.toString() + "']['metadata']).toString() + "<span><button class='download' onclick='download()'>Download</button></span><span><button class='tune' onclick='finetune'>Fine-tune</button></span></p>");
}
n+=15;
document.getElementById("results").innerHTML = results;
}
window.onload = display_res();
function finetune() {
$.ajax({
method: "POST",
url: "/finetune",
data: {name: {{name}}}
});
}
</script>
You should change it to window.onload = display_res;
Function shouldn't be called at onload but be registered.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.