Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript">
- // $(document).height() is total height.
- $(window).scroll(function (){
- if($(document).height() <= $(window).scrollTop() + $(window).height()){
- loadmore();
- }
- });
- function loadmore(){
- var val = document.getElementById("row_no").value;
- $.ajax({
- type: 'post',
- url: 'get_results.php',
- data: {
- getresult:val
- },
- success: function (response) {
- var content = document.getElementById("all_rows");
- content.innerHTML = content.innerHTML+response;
- document.getElementById("row_no").value = Number(val)+10;
- }
- });
- }
- </script>
- <div id="all_rows">
- <?php
- mysql_connect('localhost','root','');
- mysql_select_db('demo');
- $select=mysql_query("select comment from sample_comment limit 0,10");
- while($row=mysql_fetch_array($select))
- {
- echo "<p class='rows'>".$row['comment']."</p>";
- }
- ?>
- </div>
- <input type="hidden" id="row_no" value="10">
Add Comment
Please, Sign In to add comment