I have the following table:
<table id="tabela">
<thead>
<tr>
<th>Produto</th>
<th>Cliente</th>
</tr>
</thead>
<tbody>
<tr>
<td id="produto1"><a href="" data-toggle="modal" data-target="#myModal">Banana</a></td>
<td id="cliente1"><a href="" data-toggle="modal" data-target="#myModal">José da Silva</a></td>
</tr>
</tbody>
</table>
As you can see, in the table I have 2 links on the same line, a link must show the product data in a modal and the other shows the customer data. To show the modal of the product I used the following Jquery script:
$(document).on("click","#tabela td a",function(e){
e.preventDefault()
var idproduto= $(this).parent().attr("id");
$('.modal-body').load('dados_produto.php?id='+idproduto);
});