Search code examples
javascriptjqueryajaxdjangodjango-endless-pagination

How catch callback after new page was loaded?


I use pagination on scroll by Django EL(Endless) Pagination library in my project.

Question: Is there any way to catch callback that will fire at the end of the request cycle, after new items have been appended to the container?! I need to refresh one script which don't work for added items. Do you have any ideas?


Solution

  • You can use onCompleted callback to perform some action after the new page is fully loaded in the DOM

    <script>
        $.endlessPaginate({
            onCompleted: function(context, fragment) {
                // your code here
            }
        });
    </script>