I am currently using this Code below to search for the page with the products for the requested tag.
echo '<a class="marca" href="prod_index_marca.php?codmarca='.$res['codigo'].'">'.$res['nome_marca'].'</a>';
But I'm trying to create a Request for this same content to open in a "DIV" without Refresh, like this:
echo '<a class="marca" style="cursor:pointer;">'.$res['nome_marca'].'</a>';
<script language="javascript">
$(document).ready(function(){
$('.marca').click(function(){
$.ajax({url:"prod_index_marca.php?codmarca=<?php $res['codigo'];?>",success:function(data){
$('#visual').html(data);
}});
});
});
And the page "prod_index_marca.php" is starting with the following PHP below, and with all $ res referring to the products of the brand selected through its "codmarca":
<?php
include "conexao.php";
$codmarca = $_GET['codmarca'];
$sql = $pdo->prepare("SELECT * FROM produto WHERE codmarca = '$codmarca'");
$sql->execute();
foreach($sql->fetchAll() as $res){
?>