Answer the question
In order to leave comments, you need to log in
How to do pagination with ajax?
Hello!
I need to make pagination via ajax, but I used to work with ajax and have no idea how to implement it. I tried to search for something, but there really is nothing explained.
Help me please
Answer the question
In order to leave comments, you need to log in
Alternatively, you can pass some attribute to the page links so that the attribute matches the link, at least partially. Then make a function to get the text (with or without tags) and pass them to the block where the main content is displayed. maybe It's not the best solution, but it should work.
$(document).ready(function(){
function changePage() {
// mainElem это элемент, куда будет свтавляться ваша загружаемая страница
var mainElem = $('.anyElement')
var attr = $(this).attr('name');
var href = attr + '.html'
$.get( href, function( data ) {
mainElem.html(data)
});
}
$('li').click(changePage)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question