You can change the location.hash
property, it will change the current anchor identifier without navigating away form the page, for example you could:
<a href="http://mysite.com/cats" id="cats" class="ajaxLink">Cats</a>
<a href="http://mysite.com/dogs" id="dogs" class="ajaxLink">Dogs</a>
Then:
$('.ajaxLink').click(function (e) {
location.hash = this.id; // get the clicked link id
e.preventDefault(); // cancel navigation
// get content with Ajax...
});?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…