I am trying to use infinite scrolling to load the next 5 peices of content onto my screen without reloading the entire page. I have tried about a million things. I have the scroll bar tracking working great, but I have no idea how to set up an ajax request to load additional content when the scroll bar script is activated. Please help I have been stuck on this for two days.
here is my java script:
<script type="text/javascript">
function yHandler(){
var wrap = document.getElementById('wrap');
var contentHeight = wrap.offsetHeight;
var yOffset = window.pageYOffset;
var y = yOffset + window.innerHeight;
if(y >= contentHeight){
// Ajax call to get more dynamic data goes here
wrap.innerHTML += '<div class="newData"></div>';
}
var status = document.getElementById('status');
status.innerHTML = contentHeight+" | "+y;
}
window.onscroll = yHandler;
</script>
here is my php file to connect to my database:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_dbConn = "localhost";
$database_dbConn = "Video";
$username_dbConn = "root";
$password_dbConn = "root";
$dbConn = mysql_pconnect($hostname_dbConn, $username_dbConn, $password_dbConn) or trigger_error(mysql_error(),E_USER_ERROR);
?>