I need to pass product id to javascript function so that every product shows different time when added to the booking page. Currently it is showing same time even if I add multiple products to booking e.g.
I am getting
27:12     Product 1
27:12     Product 2
but I need
27:12     Product 1
29:30     Product 2
I dont have much expertise in Javascript because of which I am lacking in to it. My script and part of PHP Laravel code is below. Thank you for the help
SCRIPT
<script>
var count = 1800;
var counter = setInterval(hockeytimer, 1000);
function hockeytimer() {
  setSessionStorage(count)
  count = sessionStorage.getItem('count') - 1;
  sessionStorage.setItem('count', count);
  
  if (count == -1) {
    clearInterval(counter);
    return;
  }
  var seconds = count % 60;
  var minutes = Math.floor(count / 60);
  var hours = Math.floor(minutes / 60);
  minutes %= 60;
  hours %= 60;
  if (hours === 0 && minutes === 0  && seconds === 0 ) {
    var table = document.getElementById("hockeyt");
    for (var i = 0 ; i <= table.rows.length+2; i++) {
      table.deleteRow(i-1);
    }
  }
  
  var time_str = hours + ":h " + minutes + ":m " + seconds + ":s";
  var timerCells = document.querySelectorAll('.hockeytimer');
  
  for (var i = 0; i < timerCells.length; i++) {
    var timerCell = timerCells[i];
    timerCell.innerHTML = time_str;
  }
}
function setSessionStorage(countVal) {
  if(sessionStorage.getItem('count') <= 0){
    sessionStorage.setItem('count', countVal);
  }
  if(!sessionStorage.getItem('count')) {
    sessionStorage.setItem('count', countVal);
  }
}
 </script>
HTML
 <div style="display:none;" data-product-name="{{$p->product_name}}" id="product-id"></div>
 <div class="hockeytimer"></div>
