I'm trying to set up a refresh on div after an object array has received the necessary inputs and has been submitted for displaying. So far I've done this:
var users = [
{name: "John Smith", description: "Some chap", image: "None"},
{name: "Elizabeth II", description: "A fancy lass", image: "None"}
];
function arrayAdd() {
var title_text = $("#title_text").val();
var description_text = $("#description_text").val();
var image_text = $("#image_text").val();
users.push({name:title_text,description:description_text,image:image_text});
console.log(users);
for (var i = 0; i <= users.length; i++) {
$("#users").html(users[i]['name']);
};
}
But that only shows the last value added, can you please show me a way to mend this?