I am trying to put all object names in HTML and I am using this function.
function getExistingLinks() {
$.post( "http://0.0.0.0:9292/api/links", function( data ) {
var names = data.map(function (i) {
return i['link'].name
});
document.querySelector(".link-names").innerHTML = names;
});
}
html is very simple:
<form id="addbookmark">
<p><label for="title">Title</label><br />
<input type="text" id="title" name="title" size="50" value="" /></p>
<p><label for="url">Url</label><br />
<input type="text" id="url" name="url" size="50" value="" /></p>
<p class="link-names"></p>
<p><input id="save" type="submit" value="Save Link" /></p>
</form>
But in this situation all the names ale in one div .link-names, I would prefer put each name in separate div .link-name How can I do this?