Is there any way to stay on a scroll position when an ajax is in refresh interval every 3 seconds? Here is the code that is in another webpage called "sample.php":
<script type="text/javascript" src = "includes/jquery.js"></script>
<script>
var inProcess = false;
setInterval( function () {
if (inProcess) {
return false;
}
inProcess = true;
jQuery.ajax({
url: 'data.php',
data: '',
method: 'POST',
success: function(answer) {
jQuery('#Load').html(answer);
inProcess = false;
},
error: function() {
inProcess = false;
}
});
}, 3000 );
</script>
<div id = "Load"> </div>
Inside data.php, I just run a query to echo out table rows. The ajax in sample.php, basically sends a request to data.php every 3 seconds to "repeat" the query so when a new value enters the database, it will automatically echo out after 3 seconds. It works but I would like the scroll position to stay where it is every time the ajax reloads.