Well I'm messing with these commands, in reality what I'm wanting to do is the following. Using localStorage
maintain a database.
NOME TABELA | DADOS TABELA
tbl_TESTE | {teste 01, teste02, teste03, ...}
tbl_TESTE02 | {arroz, feijão, batata, ...}
**Sendo que todos os dados da tabela é um array de OBJETOS.
When I start the application I'm setting the banks as nulls I do this:
localStorage.setItem("tbl_TABELA01", []);
localStorage.setItem("tbl_TABELA02", []);
localStorage.setItem("tbl_TAVELA03", []);
This is done only once so as not to reset the already entered data.
After inserting I do this as follows:
var nome = $("#lblNome").val(),
telefone = $("#lblTelefone").val();
var dados = [];
dados.lbNome = nome;
dados.lbTelefone = telefone;
console.log(dados);
//var result = JSON.stringify(dados);
// console.log(result);
var tbl_CELULAS = localStorage.getItem("tbl_CELULAS");
console.log(tbl_CELULAS);
// var parsetbl_CELULAS = JSON.parse(tbl_CELULAS);
// console.log(parsetbl_CELULAS);
tbl_CELULAS.push(dados);
console.log(tbl_CELULAS);
//var JSON = JSON.stringify(tbl_CELULAS);
console.log(JSON);
This is a mess because I am not sure how to set up the logic in order to solve the problem. What I need is before inserting, get what I already have in the siteStorage, thus inserting in the last position what I just searched, then last save again in the localStorage.