I tried the solution posted on this [adding objects to array in localStorage but it doesnt seem to work for me.Mine has a small change,I am getting the values as a list from python flask app:
var myValue = {{ List|safe }};
onload=function appendRow() {
var names = [];
names = myValue;
var existingEntries = JSON.parse(localStorage.getItem("allEntries")) || [];
localStorage.setItem("oltbl", JSON.stringify(names));
existingEntries.push(oltbl);
localStorage.setItem("allEntries", JSON.stringify(existingEntries))
var storedNames = JSON.parse(localStorage.getItem("allEntries"));
var tbl = document.getElementById('mixed'),
row = tbl.insertRow(tbl.rows.length),
i;
for (i = 0; i < tbl.rows[0].cells.length; i++) {
createCell(row.insertCell(i), storedNames[i], 'row');
}
}
function createCell(cell, text, style) {
var div = document.createElement('div'),
txt = document.createTextNode(text);
div.appendChild(txt);
cell.appendChild(div);
}
</script>
<body>
<table id="mixed">
<tr>
<th>Title</th>
<th>Text</th>
<th>STATUS</th>
</tr>
Any pointers?
var storedNames = JSON.parse(localStorage.getItem("allEntries"));instead ofvar storedNames = JSON.parse(localStorage.getItem("oltbl"));andoltblis not defined, so you push nothing into your array