ANSWER: This is correctly closed as server-side/client-side. I'm using AJAX for this instead.
I need a woocommerce function to generate output when a span is clicked. This JS creates a collapse-able action in the div and attempts to take the div id and do get_attributes with it. Then it fills the div with it's output.
<script>
 var coll = document.getElementsByClassName("collapsible");
 var i;
 for (i = 0; i < coll.length; i++) {
   coll[i].addEventListener("click", function() {
     this.classList.toggle("active");
     var content = this.nextElementSibling;
     if (content.style.display === "block") {
       content.style.display = "none";
     } else {
       content.style.display = "block";  
       var uhh = content.getAttribute("id");
       var uhh2 = "<?php get_term_by('term_id', $uhh, 'pa_producer'); ?>";
       content.innerHTML = uhh2 ;     
       }
   });
 }
</script>
Also var uhh2 = "<?php echo $uhh; ?>"; doesn't work
I can't get anything returned from this php, either with echo or print_r or var_dump. The div class is "collapseable" if that makes it clearer how I'm handling the current element. When I use content.innerHTML = uhh then it returns the correct div id, so I know that this function is firing.
How am I improperly handing these vars?
 
    