Infinite list: after “Go back” to the list, the new elements are not there any more. How to restore them?
Im using AJAX to make an infinite list of elements (products). When I go to another page far from the list, and then "Go back" using the browser to the list page, the products added while scrolling down
are not anymore there..
My question: after "Go back",
how to show the products again (even those added while scrolling down)?
I thought in these two options:
Option 1 : restore them in some way since they were already shown in the client. In other words, they already are in the user's computer. is this possible???
Option 2: make another AJAX request to restore the products.
This is the kind of AJAX request Im using to get the products while scrolling down:
- <a href="{{ path('product1') }}">product 1</a>
- <a href="{{ path('product2') }}">product 2</a>
- <a class="get-products" href="#">Get more products</a>
-
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
- <script type="text/javascript">
- $('.get-products').on('click',function() {
- event.preventDefault();
- $.ajax({
- type: 'GET',
- url: 'http://procom/app_dev.php/get-more-products',
- success: function(response) {
- $('body').prepend(response);
- }
- });
- });
- </script>
-