Last active
November 17, 2018 16:22
-
-
Save armanhakimsagar/5fa624ee153ae028bdb2facec508f96d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript" src="jquery.js"></script> | |
| <script type="text/javascript"> | |
| // $(document).height() is total height of current screen. | |
| // scrollTop is scroll from top , if top to scroll & total height exists current window size | |
| $(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"> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment