0
I am successfully using the script below to open in Visual DIV, products related to selected brand:
Link to the Brands:
<a class="marca" style="cursor:pointer;" id="'.$res['codigo'].'">'.$res['nome_marca'].'</a>
Script for the Tags:
<script language="javascript">
////// Visualiza o produto da Marca selecionada //////
$(document).ready(function(){
$('.marca').click(function(){
var cod = $(this).attr('id');
$.ajax({url:"prod_index_marca.php?codmarca="+cod,success:function(data){
$('#visual').html(data);
}
});
});
});
</script>
In sequence, I would like to open the details of each Brand product selected from within the Visual DIV, for itself.
I used the same method to open the brands, so:
Link to Product Details:
<a class="detalhe_5" style="cursor:pointer;" id="<?php echo $res['codigo']; ?>">
<img style="width:100%; max-width:100px;" src="img_produtos/<?php echo $res['img01']; ?>" />
</a>
Script for the Details:
<script language="javascript">
////// Para visualizar o item selecionado //////
$(document).ready(function(){
$(".detalhe_5").click(function(){
var cod = $(this).attr("id");
$.ajax({
url:"prod_detalhe_5.php?codigo="+cod,success:function(data){
$("#visual").html(data);
}
});
});
});
</script>
But I’m not getting an answer, when I click on the link, the page becomes static, ie nothing happens.
I can count on friends to solve this problem?
I can’t figure out why it doesn’t work.
On console shows some error?
– Lucas de Carvalho
if you access the url directly in the browser get some response?
– Lucas Brogni
Hello Lucas Brogni, yes I downloaded the URL and returned the following message: "Undefined index: codigo in C: wamp www Commerce prod_5.php on line 11" .
– Murilo
And on the "prod_details_5.php" page it looks like this:
– Murilo
<?php
 $codigo = $_GET['codigo'];
 $sql = $pdo->prepare("SELECT * FROM produto WHERE codigo = $codigo") or die(mysql_error());
 $sql->execute();
 foreach($sql->fetchAll() as $res){
 ?>
– Murilo