On custom tab of product detail page on front end i have added a table and used Pager for pagination.


But this reloads the entire page when pagination is used. I don't want to reload the entire page.

Is their any way to use ajax along with Pager?

If not then can you recommend some other way around?



There are some good infinite scroll plugins. Not sure about ajax pagination but could be done by creating a controller that just returns the layout of the product grid and returns the ajax and replaces the block each time.

This https://github.com/czone-tech/magento2-ajaxified-catalog has a good starting point atleast and may of even done ajax pagination (the demo currently isn't working and i cant remember). But with that if it doesn't have it you could just add some javascript and update the links so they just run some ajax query on the pagination to pull the correct page (just add ajax=1 parameter) and replace the response with the product list element from there.

I have created ajax search and infinite scroll pretty easily with this so pagination shouldn't be a problem.


You can try the following approach:

require(['jquery'], function($){
        $('.your-pager-items a').on('click', function(evt){
            $.get(evt.currentTarget.href, {}, function(r){
              // do something with the response

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.