hi everyone i need to pass an array value to a new html page. i tried but the array value is always resetting
here is my code
var cart=[];
var jumlah=0;
var total=0;
function add(index)
{
if(index==1)
{
jumlah=prompt("masukan jumlah");
if(jumlah==0||jumlah<0||jumlah==null)
{
alert("harap masukkan jumlah, dengan format yang benar");
}
else
{
total=jumlah*500000;
cart.push('Razer Destructor Battlefield @ IDR 500.000|| Jumlah '+jumlah+' || total '+total);
for(var i=0;i<cart.length;i++)
{
alert("barang telah di tambahkan ke keranjang");
}
}
}
else if(index==2)
{
jumlah=prompt("masukan jumlah");
if(jumlah==0||jumlah<0||jumlah==null)
{
alert("harap masukkan jumlah dengan format yang benar");
}
else{
total=jumlah*2020000;
cart.push('Razer blackwidow ultimate mechanical keyboard for gaming @ IDR 2,020,000|| Jumlah '+jumlah+' || total '+total);
alert("barang telah di tambahkan ke keranjang");
}
}}
i need to pass that cart[] array from product.html to a a new page called cart.html
can u guys help me? sorry im a beginner and sorry for bad english. thanks for ur help!!
cartarray using localStorage/sessionStorage and then access it on the next page. Reference