Guest User

Untitled

a guest
Nov 16th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. <script type="text/javascript" src="jquery.js"></script>
  2.  
  3. <script type="text/javascript">
  4.  
  5. // $(document).height() is total height.
  6.  
  7. $(window).scroll(function (){
  8. if($(document).height() <= $(window).scrollTop() + $(window).height()){
  9. loadmore();
  10. }
  11. });
  12.  
  13. function loadmore(){
  14. var val = document.getElementById("row_no").value;
  15. $.ajax({
  16. type: 'post',
  17. url: 'get_results.php',
  18. data: {
  19. getresult:val
  20. },
  21. success: function (response) {
  22. var content = document.getElementById("all_rows");
  23. content.innerHTML = content.innerHTML+response;
  24. document.getElementById("row_no").value = Number(val)+10;
  25. }
  26. });
  27. }
  28. </script>
  29.  
  30. <div id="all_rows">
  31.  
  32. <?php
  33.  
  34. mysql_connect('localhost','root','');
  35. mysql_select_db('demo');
  36. $select=mysql_query("select comment from sample_comment limit 0,10");
  37. while($row=mysql_fetch_array($select))
  38. {
  39. echo "<p class='rows'>".$row['comment']."</p>";
  40. }
  41. ?>
  42.  
  43. </div>
  44.  
  45. <input type="hidden" id="row_no" value="10">
Add Comment
Please, Sign In to add comment