i dont know how can I make it work. I explain it.
I have some html code with jquery script.
html
<div id="accordion">
<h3><a class="0" href="#">aparamenta modular</a></h3>
<div>
<div class="cat_content_ex">
térmicos, diferenciales, etc ...
</div>
</div>
<h3><a class="1" href="#">iluminación</a></h3>
<div>
<div class="cat_content_ex">
luminarias std y sistemas de LED, etc ...
</div>
</div>
</div>
<div id="target"></div>
script
<script type="text/javascript">
$('h3 > a').live('click', function(){
var currentClass = $(this).attr('class');
alert ( currentClass, 'alert window');
if(currentClass == '0') {
<?php
include "./connection_catalogs.php";
$SQL = "SELECT * FROM first_table";
$result = mysql_query($SQL);
while ($row = mysql_fetch_array($result)) { ?>
$('#target').html($(<?php echo "<p class='ctg_fab'>" .$row['fabricante']. " : " .$row['titulo']. " : <a href='" .$row['url']. "'>descarga</a> : tipo - " .$row['filetype']. "</p>";?>));
}
} else if(ctg == '1') {
<?php
include "./connection_catalogs.php";
$SQL = "SELECT * FROM second_table";
$result = mysql_query($SQL);
while ($row = mysql_fetch_array($result)) { ?>
$('#target').html($(<?php echo "<p class='ctg_fab'>" .$row['fabricante']. " : " .$row['titulo']. " : <a href='" .$row['url']. "'>descarga</a> : tipo - " .$row['filetype']. "</p>";?>));
}
}
?>
}
});
</script>
user click in first header of accordion and show the content for sql table named ‘first_table’ by executing echo "<p class='ctg_fab'>" .$row['fabricante']. " : " .$row['titulo']. " : <a href='" .$row['url']. "'>descarga</a> : tipo - " .$row['filetype']. "</p>";
user click in second header of accordion and show the content for sql table named ‘second_table’ by executing echo "<p class='ctg_fab'>" .$row['fabricante']. " : " .$row['titulo']. " : <a href='" .$row['url']. "'>descarga</a> : tipo - " .$row['filetype']. "</p>";
$('#accordion.h3')selects an element withid="accordion" class="h3".Change it to
$('#accordion > h3')which selects an<h3>element that has a parent element withid="accordion".