Reputation: 18029
Is it possible to load all the links with class 'ajax' without refreshing the page? The complete body content should be changed, the page title and the url should so it can be bookmarked.
Upvotes: 1
Views: 1276
Reputation: 14808
This should work for all links with a certain class, 'target' is the id of your main content div. It requires no editing of your current mark up.
$('.class').click(function(e) {
e.preventDefault();
$('#target').load($(this).attr('href'));
});
Upvotes: 2
Reputation: 4084
$('a.blah').click(function(e){
e.preventDefault;
$.get('page.html', function(data){
$('body').html(data);
});
});
That is probably the simplest way, replace blah with your class, and page.html with your page.
Upvotes: 3