For the most part, it all depends on the corresponding server-side logic (php, ruby, etc.), it will depend on what methods are best to request, load and wrap the returned data.
In this situation, we are obviously talking about pagination, which is often implemented by a get-request to the server. An example of a client script might be something like this:
function loadContent(link) { var http = createRequestObject(); if( http ) { http.open('get', link); http.onreadystatechange = function () { if(http.readyState == 4) { var div = document.createElement('div'); div.innerHTML = http.responseText; var all = div.getElementsByTagName('div'); for (var i = 0, len = all.length; i < len; i++) { if (all[i] && all[i].getAttribute('id') == 'next-page-music-items-wrap') { var deep = all[i].getElementsByClassName('next-page-music-item'); $('.current-page-music-items-wrap').append(deep); } } } } http.send(null); } else { document.location = link; } } function createRequestObject() { try { return new XMLHttpRequest() } catch(e) { try { return new ActiveXObject('Msxml2.XMLHTTP') } catch(e) { try { return new ActiveXObject('Microsoft.XMLHTTP') } catch(e) { return null; } } } }
ajax scroll. Find in any search engine. - Dimava