解决方法
按照惯例建立菜单,即
<ul id="menu"> <li><a href="about-us.html">About Us</a> <li><a href="services.html">Services</a> <li><a href="products.html">Products</a> </ul>
和内容的占位符.
<div id="content"></div>
然后运行类似于此的代码
$("#menu li a").click(function(e) { // prevent from going to the page e.preventDefault(); // get the href var href = $(this).attr("href"); $("#content").load(href,function() { // do something after content has been loaded }); });