0

I am working on a project where there is no user login system where people come and select multiple events they want to be in. From javascript, I wrote a code where if a user clicks it will store the id of an event in a javascript array but when I go to the checkout page the data gets cleared. So I came up with the idea of using localstorage of javascript. I have reached here:

var myData = '';
var livalue = [];
$('.party_a').on('click', function(e){
    alert('One item added to the cart!');
    sessionStorage.setItem("livalue", $(this).val());
    alert(localStorage.getItem("livalue"));
    myData = partyName.length;
    if(myData == 1){
      $('#cart').html("<li><a href='{{ route('checkout') }}'>My Cart<sup id='cart_number'></sup></a></li>");
    }
    $('#cart_number').html(myData);
});

But when I try to alert the livalue, it gives me null. Any suggestion on this matter is appreciated.

0 Answers0