Search code examples
phpjquery-ias

jquery-ias : page with some php variable?


I've a got a "strange problem" with Jquery-IAS (http://infiniteajaxscroll.com/).

Everything is ok when I use a simple page like index.php for example but when I use a variable like index.php?variable=foo to filter my query with only "foo" values in my database (using PDO prepare to have the $_GET result), Jquery-IAS doesn't work anymore (infinite loading).

I read the support on the website but I couldn't find the answer. I think the "load method" will be the answer but it isn't.

Any idea ?

Edit: this is the error on console when I do the first scroll:

jquery.min.js:4 GET http://localhost/ch/index.php 404 (Not Found)

Solution

  • Ok I find the solution. Just use the next event : http://infiniteajaxscroll.com/docs/events.html#next

    Triggered when the next page should be loaded. Happens before loading of the next page starts.

    With this event it is possible to cancel the loading of the next page. You can do this by returning false from your callback.

    Say you want to stop loading more pages if you hit a certain url:

    ias.on('next', function(url) {
        if (url.match(/page3\.html/)) {
            return false;
        }
    })