I'm developing a website, where I have several products, for example and a button for each of them.
When I click the button, it opens a modal (Bootstrap).
But, I want to generate the contents of this modal, or the entire modal even dynamically with a function in PHP
For example, a product with data
Nome: Carro,
Valor: 3,000.
Then I send the information to the function:
gerarmodal($nome, $valor);
And it returns me the modal, or the content of it, with the values of the variables in their proper places.
"You are buying a Car for the value of 3,000 reais."
I know you need to use javascript along with php, to request the data without refresh. I've tried but I can not come up with a logic to make it work.
How could I do this and view the modal on my page?