I was working on a method that can erase all of the array content in "Bottin". The data is stored on the LocalStorage of the computer in a key called "Data".
Here's my sample of Json :
{
"descriptions": [
{
"Fabricant": "Test",
"Produit": "Test",
"Prix": "11.11",
"Details": " asdfasd",
"Categorie": "Categorie_Baseball",
"Images": "Hockey_Article_01.jpg"
},{
"Fabricant": "Test",
"Produit": "Test",
"Prix": "11.11",
"Details": " asdfasd",
"Categorie": "Categorie_Baseball",
"Images": "Hockey_Article_01.jpg"
},{
"Fabricant": "Test",
"Produit": "Test",
"Prix": "11.11",
"Details": " asdfasd",
"Categorie": "Categorie_Baseball",
"Images": "Hockey_Article_01.jpg"
}
],
"Bottin": [
{
"Nom": "Andy",
"Prenom": "Matador",
"Fonction": "dtesasd",
"Courriel": "[email protected]",
"Telephone": "515-555-5555"
}, {
"Nom": "Andy",
"Prenom": "Matador",
"Fonction": "dtesasd",
"Courriel": "[email protected]",
"Telephone": "515-555-5555"
},{
"Nom": "Andy",
"Prenom": "Matador",
"Fonction": "dtesasd",
"Courriel": "[email protected]",
"Telephone": "515-555-5555"
}
],
"users": {
"admin": "Inf2005"
}
}
Here's my partial solution :
function delAllBottin() {
bd = localStorage.getItem('data');
var descJsonObjects = bd.Bottin;
bd.Bottin.splice(0, descJsonObjects.length);
}
Doesn't seem to work for now, i don't know what i'm missing here ...