Skip to content

Instantly share code, notes, and snippets.

@hackerrahul
Created May 26, 2018 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hackerrahul/de46b85b6e6fdc6679bb1c797a3cd7a1 to your computer and use it in GitHub Desktop.
Save hackerrahul/de46b85b6e6fdc6679bb1c797a3cd7a1 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
$(document).ready(function(){
var start = 0;
$.ajax({
type : "GET",
url : "get_data.php",
data : {
'offset' : 0,
'limit' : 5
},
success: function(data){
$('.post').append(data);
start += 5;
}
});
$(window).scroll(function(){
if($(window).scrollTop() >= $(document).height() - $(window).height()){
$.ajax({
type : "GET",
url : "get_data.php",
data : {
'offset' : start,
'limit' : 5
},
success: function(data){
$('.post').append(data);
start += 5;
}
});
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment