Here, there was such a problem. What would you understand it will have much to describe.

For example, let's take the Vkontakte social network. There is a splash, if I turn the songs down, I will automatically load the page, how can I do this. If you can throw a link to a good lesson

  • lazyload or ajax'om this whole thing load - Lieutenant Jim Dangle
  • Look for ajax scroll . Find in any search engine. - Dimava
  • We catch onscroll event. Caught - if the current page scroll exceeds the threshold value, we make an AJAX request that receives the next part of the page. Done - insert the answer at the end, the threshold value of the scroll increased. Such is the recursion. - Goncharov Alexander
  • Thank you for what I would do without your help. Already the night I have been doing the project for 2 months, I have learned such a bunch of technologies, that the brain will soon soon get to the skull)) - TomasRedl

1 answer 1

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; } } } }