I have a chat box that i want to update :-) But I want only to refresh the div and not the hole page... Can someone help me??
Code:
<div align="right" id="chat">
<?php
include 'Chat.php';
?>
</div>
I have a chat box that i want to update :-) But I want only to refresh the div and not the hole page... Can someone help me??
Code:
<div align="right" id="chat">
<?php
include 'Chat.php';
?>
</div>
You can't do it with a server side script like php
However, Using jQuery, when you need to update the div. Simply use
$("#chat").load("Chat.php");
For an example, make a request to the server when a user finishes typing on a textbox, and load the recent chat text.
$("#textbox").change(function() {
$("#chat").load("Chat.php");
});
checkout this one. Its easy to implement and pretty useful.
http://www.9lessons.info/2009/07/auto-load-refresh-every-10-seconds-with.html
also see this
Auto-refreshing div with jQuery - setTimeout or another method?
Good luck..
If you are not that good at Javascript or Ajax or jQuery, then you might want to create a link with a get variable like include = 1, and when it is equal to one, include another page with the information you want. But it is worth learning jQuery and the like.