Closed denoise closed 3 years ago
I'm using Infinite Scroll loading the data from a JSON and it's working fine if I don't enable the history.
A problem occurs when I enable the history: 'replace' option that changes the page URL for the subfolder and path of my server-side script breaking all links and images.
Here is my init code:
$infiniteContainer = $('#resultsContainer').infiniteScroll({
path: function() { return 'ajax/ajax.items.php?' + '&s=' + searchStr + '&cat=' + filterCat + '&sub=' + filterSubCat + '&order=' + orderBy + '&offset=' + this.pageIndex; }, responseType: 'text', history: 'replace', loadOnScroll: true, checkLastPage: true
});
when I enable the history then my URL gets converted to:
mydomain.com/ajax/ajax.items.php?s=&cat=&sub=&order=&offset=1
and the URL should stay as mydomain.com/
How can I prevent infinite scroll to change the URL to the wrong path and just passing the variables I need for scrolling to a specific page?
How can I prevent infinite scroll to change the URL to the wrong path and just passing the variables I need for scrolling to a specific page?
history: false
// disable changing URL and browser history
I'm using Infinite Scroll loading the data from a JSON and it's working fine if I don't enable the history.
A problem occurs when I enable the history: 'replace' option that changes the page URL for the subfolder and path of my server-side script breaking all links and images.
Here is my init code:
when I enable the history then my URL gets converted to:
mydomain.com/ajax/ajax.items.php?s=&cat=&sub=&order=&offset=1
and the URL should stay as mydomain.com/
How can I prevent infinite scroll to change the URL to the wrong path and just passing the variables I need for scrolling to a specific page?