I may be reinventing the wheel but that's intentional. I am trying to make a real-time chat application using PHP HTML MySQL CSS. It's working quite well over the network and grabbing new content every second. In IE you can notice a flicker every second, seemingly it is pulling all that data again and again, even if there's no new content, and I don't like that.
Here is my refresh JS code:
$(document).ready(function() {
$("#data").load("data.php");
var refreshId = setInterval(function() {
$("#data").load('data.php');
}, 1000);
$.ajaxSetup({ cache: false });
});
data.php is just a while looping through all the database records and showing them:
while ($row = mysql_fetch_array($result))
{
echo "<p><b>". $poster ."</b>: ". $message ."<br /><span style='font-size: 10px;'>". date('D d M - g:i:s a', strtotime($row['when'])) ."</span></p>";
}
I've looked and looked on the internet for solutions, fading etc, I can't think of how to accomplish this, surely there is some nice and easy and efficient way?