Level 60
Hi!
// 1. press on the button
// 2. send an ajax request to some end point like /product/product_id
// 3. on success open modal with bind*ed data
// basic example
document.querySelector('button').addEventListener('click', function(e) {
e.preventDefault();
fetch('/product/'+ this.id)
.then(function(response) {
document.querySelector('title-modal').val = response.title;
document.querySelector('price-modal').val = response.price;
modal.open();
});
});
This is not going to work, just basic example
1 like