webcreate / infinite-ajax-scroll

Turn your existing pagination into infinite scrolling pages with ease
https://infiniteajaxscroll.com
Other
898 stars 349 forks source link

Doesnt work if link includes Get request (?srch=value) #720

Closed picarica closed 2 years ago

picarica commented 2 years ago

Bug report

so i have site i am using pagination and if get request is present it will include that get request in pagination links too, so that it transfers over to new page

Code and configuration snippets that reproduces the problem

<a href="/page2/?srch=test">Next</a> so i dont think there is need to put in codesandbox this is the next href link when get request is present, my php code is as this
'linkMarkup' => "<a href='{url}?srch={$input->get->text('srch')}'><span>{out}</span></a>"]; nothing too complicated but ajax scroll doesnt seem to work with it, by itself it works flawlessly i just click the link and i am on next page with new request also this is my initiation code

let ias = new InfiniteAjaxScroll('#grid-game', {
    item: '.GameTile.card.game',
    next: '.MarkupPagerNavNext > a',
    pagination: '.MarkupPagerNav',
    spinner: '#spinner',
});

also this is the error log in console

Start loading https://test1.mysecreturl.org/page2/?srch=test     infinite-ajax-scroll.min.js:11:8863
XHRGEThttps://test1.mysecreturl.org/page2/?srch=test&1638530810077 //note from me, idk why it adds these random numbers to the end they are in the pagination
[HTTP/1.1 500 Internal Server Error 119ms]

Uncaught (in promise) 
XMLHttpRequest { onreadystatechange: onreadystatechange(), readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, responseURL: "https://test1.mysecreturl.org/page2/?srch=test&1638530810077", status: 500, statusText: "Internal Server Error", responseType: "document", response: HTMLDocument }

Expected behavior

carry over the get request as it works without infinite ajax scroll

Environment

i am using processwire CMS on LAMP stack on centos 7 system located in europe

fieg commented 2 years ago

Hi @picarica, thank you for your report.

The number 1638530810077 is an cache-busting mechanism that IAS uses, but I have the feeling that it is causing the issue here. I'm thinking about removing this way of cache-busting, but could you try one thing to make sure it is really causing the issue?

let ias = new InfiniteAjaxScroll('#grid-game', {
    item: '.GameTile.card.game',
    next: '.MarkupPagerNavNext > a',
    pagination: '.MarkupPagerNav',
    spinner: '#spinner',
});
ias.on('load', function(event) {
  event.nocache = true;
});
picarica commented 2 years ago

Hi @picarica, thank you for your report.

The number 1638530810077 is an cache-busting mechanism that IAS uses, but I have the feeling that it is causing the issue here. I'm thinking about removing this way of cache-busting, but could you try one thing to make sure it is really causing the issue?

let ias = new InfiniteAjaxScroll('#grid-game', {
    item: '.GameTile.card.game',
    next: '.MarkupPagerNavNext > a',
    pagination: '.MarkupPagerNav',
    spinner: '#spinner',
});
ias.on('load', function(event) {
  event.nocache = true;
});

this solved it thanks !