Robie taką jakby księge gości z odświeżaniem AJAX (podobno)
Na dwóch komputerach odpaliłem ta strone i komputer, ktory wysylal wpis odswiezal strone, ale "odbiorca" mial tak jak chce (czyli sie nie odswieza)
Ten skrypt jest z neta ale go troche zmienilem pod siebie
Kod
<script src="jquery-1.10.2.min.js"></script>
<script>
function check(){
$.ajax({
type: 'POST',
url: 'checker.php',
dataType: 'json',
data: {
counter:$('#message-list').data('counter')
}
}).done(function( response ) {
$('#message-list').data('counter',response.current);
if(response.update==true){
$('#message-list').html(response.news);
$("html, body").animate({ scrollTop:1000 }, 700);
}
});
}
setInterval(check,2000);
</script>
<div id="message-list" data-counter="<?php echo (int)$db->check_changes();?>">
<?php echo $db->get_news();?>
</div>
<form action="" method="post">
<input name="title" placeholder="Twoj wpis... (MAX 1024 znaków)" maxlength="1024" />
<input type="submit" value="Wyślij!" />
</form>
<script>
function check(){
$.ajax({
type: 'POST',
url: 'checker.php',
dataType: 'json',
data: {
counter:$('#message-list').data('counter')
}
}).done(function( response ) {
$('#message-list').data('counter',response.current);
if(response.update==true){
$('#message-list').html(response.news);
$("html, body").animate({ scrollTop:1000 }, 700);
}
});
}
setInterval(check,2000);
</script>
<div id="message-list" data-counter="<?php echo (int)$db->check_changes();?>">
<?php echo $db->get_news();?>
</div>
<form action="" method="post">
<input name="title" placeholder="Twoj wpis... (MAX 1024 znaków)" maxlength="1024" />
<input type="submit" value="Wyślij!" />
</form>
Naprowadzi / pomoze ktoś?
pozdrawiam Arogant