I am looking for a button click to render a section template or reload the current product via AJAX. Currently, I have all the products set up and can click a button to trigger an API call to get the section. But even though I am passing the product ID the section comes back without product data. Is there a way to have an AJAX call on a product page that will allow me to replace the current product with another one?
request = new XMLHttpRequest()
request.open('GET', '/?section_id=product-name-template&product_id='+event.target.dataset.productId, true)