Hi jquery Gurus I am new to this and I have a very difficult situation Here , Can u help me with this challenge, its very important for me and I am stuck here.
This is the scenario : 3 pages ( index, menu, content)
The index is including the menu
The menu.php has inside a link
Now I want to click on this link and load the content.php in a divission inside the index.php. Is That Possible? I tried the follow but I missing something.
//This is index.php
<div>
<?php include 'menu.php'; ?>
<p>load the content here:</p>
<ol id="new-nav"></ol>
</div>
<script>
$(document).ready(function(){
$("#test li").click(function (e) {
// Stop the link from changing the page
e.preventDefault();
// Your jQuery code.
$("#new-nav").load($(this).attr("href"));
});
});
</script>
//This is menu.php
<div id="test">
<li><a href="content.html">Content</a></li>
</div>
//the content.html is a paragraph
you are selecting the li and try to get the href attribute of it 🙂
try this
});