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 love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With