Reload <body> with jQuery and PHP
I have an index.php that updates every second user sessions:
[Index.php (before )]
<script type="text/javascript">
$(function($) {
var refresh = setInterval(function() {
$.post('myfolder/reload_info.post.php', {
id: <?php echo $_SESSION['id']; ?>
}, function(data){
clearInterval(this);
});
}, 1000);
});
</script>
[reload_info.post.php]
(sql query... // $row is the result)
$_SESSION['name'] = $row->name;
$_SESSION['mail'] = $row->mail;
$_SESSION['status'] = $row->stat;
$_SESSION['cf'] = $row->cf;
All functions of the site using any session are usually charged if there is any change in the database (MySQL). What I would like is to update the body of index.php () without reloading the page.
That is, if I open the index.php file and have nothing between the and editing the file I put any text after this a second, carrying the text without having to press F5 or take a location.reload ().
Is it possible? Thank you.
Total Views: 24 Today Views: 0















