vendredi 30 janvier 2015

Javascript matrix array issue


I'm creating a very simplified version of a drag and drop shopping cart with jqueryui. My issue is regarding adding data(id, name, price) to an array.


I tried several methodes of adding the data (also an array) to the main container(array). But I keep getting this error: Uncaught TypeError: undefined is not a function



var data = [];
function addproduct(id,name,price){
//var d = [id,name,price];
data[id]["name"] = name;
data[id]["price"] = price;
data[id]["count"] = data[id]["count"]+1;
console.print(data);
}


the addproduct() function can be called by pressing a button





Aucun commentaire:

Enregistrer un commentaire