I would like to know how I can display a local storage variable (Both variables are different). I can fetch both variables but display only at a 1 element. If you look at the full code I added comments too.
!ISSUE FIXED! Solution add another script tag and add another local storage to exactly the same
storage js
   const petsData {[
    {
              name: "Meowsalot",
              species: "Cat",
              photo: "https://learnwebcode.github.io/json-example/images/cat-1.jpg"
              }
];
//actual storage 
function saveBook(name, photo) {
  localStorage.setItem("name", name);
  window.location.href = "name.html"
}
<div class="olay" onclick="saveBook('${pet.photo}','${pet.name}');" style="cursor: pointer;"> //on click method to fetch variables
Display variables js
<body>
    <div id="result"> //NEED the 2nd variable to display on this div
    </div>
    <img src="" id="photo" />
    <script>
        if (typeof(Storage) !== "undefined") {
          var name = localStorage.getItem('name');
          var imageName = localStorage.getItem("name");
          var imageEl = document.getElementById("photo"); //this is the first variable display
          imageEl.src = imageName 
        } else {
          document.getElementById("photo").innerHTML = "Sorry, your browser does not support Web Storage...";
        }
      
      
      </script>
</body>
 
    