I've created 3 links all with hrefs that link to pages in the root of my site, Ive then created a click event that when fired uses ajax to load the hrefs appropriate page. My problem is that in doing this my url remains the same. How can I append the href value to the url?
Sample of my code:
<ul id="nav">
<li><a href="page1.html">Link 1</a></li>
<li><a href="page2.html">Link 2</a></li>
</ul>
$(document).ready(function() {
$('#nav li a').click(function(e) {
var href = $(this).attr('href');
$.ajax({
url : href,
method : 'get',
success : function(data) {
$('#content').html(data);
console.log('complete');
}
});
e.preventDefault();
});
All advise welcome :) Thanks