This attribute below is working with href , and directing me to the page you want.
<a href="prod_detalhe_5.php?codigo=<?php echo $res['codigo']; ?>">
<img src="img_produtos/<?php echo $res['img01']; ?>" />
</a>
I would like to use a REQUIREMENT to open the selected item in a DIV with the Class so there is no refresh on the page.
I tried to create the attribute with the script below but without success, because when I click the link nothing happens, it does not direct me to the prod_detalhe_5.php page with the product data and does not inform me no type of error, is totally static.
<a class="detalhe" style="cursor:pointer;" id="<?php echo $res['codigo']; ?>">
<img style="width:100%; max-width:100px;" src="img_produtos/<?php echo $res['img01']; ?>" />
</a>
<script language="javascript">
$(document).ready(function(){
$('.detalhe').click(function(){
var cod = $(this).attr('id');
$.ajax({
url:'prod_detalhe_5.php?codigo='+cod,success:function(data){
$('#visual').html(data);
}
});
});
});
</script>
With the attribute data working with href , friends can show me where I'm going wrong in the script, or even give me a hint on how I should proceed to get myself to open the < strong> prod_detalhe_5.php with product data using an AJAX REQUIREMENT to avoid refreshing the page.
Thank you in advance for your attention to my problem.