I build a navigation from a databse, where I ask for projects of different categories. So basically I have two parts of my navigation:
The first part is the naviation of the categories (culture, webdesign, etc.). If I click this, I ask my database for projects with this category and create new links with PHP:
$query="SELECT * FROM projects WHERE category=\"$category\""; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $title=mysql_result($result,$i,"title"); $id=mysql_result($result,$i,"id"); echo "<div class=\"sublink\" data-id=\"$id\" ><a href=\"#\">$title<br />"; $i++; } but it seems I can't call these links from my main page with jQuery, like I did with the categories:
<div class="link" data-subsite="design"><a href="#"> design *</a></div> $(document).ready(function(){ $('.link').click(function(){ var subsite = $(this).data('subsite'); $('#naviLeftContent').load('php/getNavi.php?category='+subsite); }); }); Now I wanted to do more or less the same with my sub-navigation to load the specific text/title/info into the right divs. But the new generated divs from my sub-navigation don't seem to be in my source code, so the JavaScript doesn't recognize them.