這是我的test.php頁面,我想加載在<< id="new-nav" >>
外部頁面的內容。加載點擊從外部li
的塞納里奧如下:我想點擊從我的菜單裏這是在<?php include 'Menu/Side-menu.html.php'; ?>
並在<< id="new-nav" >>
區域
<div id="left">
<?php include 'Menu/Side-menu.html.php'; ?>
</div>
<div id="main">
<p>This is a test</p>
<b>see the text:</b>
<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(('Menu/Side-menu.html.php').attr("href"));
});
});
</script>
你期望得到這個代碼:('Menu/Side-menu.html.php')。attr(「href」)??? –
我不知道Menu/Side-menu.html.php裏面有什麼,但爲什麼你的php包含它,然後再通過AJAX在同一頁面中加載? – Tivie
可能是因爲我不知道該怎麼辦,我有我的菜單包含它,所以我可以使用我的所有頁面 –