I am trying to display the contents of my JSON into the div class "network-info". I believe what is being written first is then overwritten by what is next in the array. What can I use to circumvent this and show everything?
$(function() {
var netinfo = function(data) {
for (var i = 0; i < data.length; i++) {
$(".network-info").html(
"<hr>" +
"<p> Adapter Name: " + data[i].name + "</p>" +
"<p> IP Address: " + data[i].ip + "</p>" +
"<p> MAC Address: " + data[i].mac + "</p>" +
"<p> Adapter ID: " + data[i].id + "</p>" +
"<hr>"
)
}
};
$.ajax({
url: "http://127.0.0.1:8080/dashboard?context=netadapters&node=5",
dataType: 'json',
crossDomain: true,
}).done(function(data) {
netinfo(data);
});
});