Jump to content

Ajax Auto Refresh for Chat


Legend123

Recommended Posts

Hi All,

 

I am new here and looking for a little bit of help on a project I have been working on. At the moment we have data streaming in to a SQL database.

 

Each new set of data is put in to a separate row in the table which we then require to display in a chat window. We can get the chat to show and we are polling the database every 3000 milliseconds for data to show.

 

However when the refresh takes place the whole div id refreshes causing the chat to appear to be flashing - even when there is no new data to display.

 

This is a simplified version of the code we are using:

<html> 
<head> 
	<style type="text/css"> 
		#load_msg
			{
				background-color:#ffffcc;
				font-size:24px;
				font-family:'Georgia', Times New Roman, Times, serif;
				font-weight:bold; 
			}
	</style> 

	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script> 

	<script> 
		var auto_refresh = setInterval(
		function()
			{
				$('#load_msg').fadeOut('slow').load('update.php').fadeIn("slow");
				}, 3000); //3000 Milliseconds or 3 seconds
	</script> 
</head> 

<body> 
	<div id="load_msg"> 
	</div> 
</body>
</html>

 

Any suggestions on how to solve this would be hugely appreciated.

Link to comment
https://forums.phpfreaks.com/topic/215642-ajax-auto-refresh-for-chat/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.