paulirish/infinite-scroll — pull request #171 by arief-hidayat (2012-05-20 13:39:48+00:00)
Title: Allow user to determine the next URL (path) to retrieve JSON data (or other data type, i.e. html)

This is related to issue #103 and pull request #150. Basically to provide support for JSON data.

The solution proposed here is general enough, it can be used not only for JSON data but HTML data.

Proposed solution:

Adding nextUrl option to let user define the URL to retrieve data for next page.
This will be useful when the data is provided by backend server (webservice/REST API).

if nextUrl option is defined (see example below), user doesn't need to specify nextSelector option.

nextUrl : function(nextPageNumber) {
return "http://url-to-json-api?page=" + nextPageNumber;
// perhaps they have different format
// var max = 10; var offset = nextPageNumber * max + 1;
// return "http://url-to-json-api?start="+ offset + "&max=" + max;
}