Javascript – unable to populate the array in alpine.js
this is my full alpine.js code @{ int MOOD = 167; } <div x-data="{ 'showModal': false, variants: [] }" x-init="fetchVariants()" x-bind:data-product-id="@MOOD"> <!-- Trigger for Modal --> <button type="button" @@click="showModal = true">Open Modal</button> <!-- Modal --> <div class="fixed inset-0 z-30 flex…