Hello, I'm not able to bring product data to <div id="services"></div>
.
I noticed that when I remove this part of code ?codsubcategoria='.$res2['nome'].'
from <li class="teste"></li>
, it brings me at least the Marks and Categories tables.
I think something is missing from Javascript, but I have no idea what, and how I can solve this problem. I count on the help of friends.
Below I list the codes used.
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#menu_cat .teste a").click(function( e ){
e.preventDefault();
var href = $( this ).attr("href");
$("#services").load( href +"#services");
});
});
<ul id="menu_cat">
<?php
include "../conexao.php";
$codigo = $_POST['codigo'];
$nome_cat = $_POST['nome_cat'];
$nome = $_POST['nome'];
$query = mysql_query("SELECT codigo, nome_cat FROM categoria ORDER BY nome_cat") or die(mysql_error());
while($res = mysql_fetch_array($query)) {
echo '<li><a href="#services">'.$res['nome_cat'].'</a>';
$query2 = mysql_query("SELECT codigo, nome, nome_cat FROM sub_categoria WHERE nome_cat = '".$res['nome_cat']."' ORDER BY nome") or die(mysql_error());
if(mysql_num_rows($query2) > 0) {
echo '<ul id="menu_cat">';
while($res2 = mysql_fetch_array($query2)) {
echo '<li class="teste"><a href="prod_index_categoria.php?codsubcategoria='.$res2['nome'].'">'.$res2['nome'].'</a></li>';
}
echo '</ul>';
}
echo '</li>';
}
?>
</ul>
Thanks in advance for the attention to my problem.