Tell me, please, a simple online chat script, so simple that I could figure it out! Nete is full of scripts but they are all complex and are made on jquery or jabber, neither I have any desire to communicate.
- august4u.biz - user19517
|
2 answers
What do you need? most are simple, here for example: Create an Ajax chat using PHP, Javascript (jQuery) and MySQL
- Yes, such a plan is simple but your example on jquery (((( - Kirpich643
- @ Kirpich643, and what's wrong with this library? Are you ready to write without jQuery? - Zhukov Roman
- Well, actually I wrote, so the list of messages is updated with ajax timer request - this method loads the server too much and the messages do not come instantly, I need something else, I think towards SSE, but then I had a lot of problems with the server on php, in general, you need to pull the answer directly from mysql but I do not know how to implement it. - Kirpich643
- use the gae - Sugar
|
so simple that I could figure it out!
Easier, 5 minutes
<iframe id="chatFrame" name="chatFrame" src="chatFrame.php"></iframe> <form action="chatFrame.php" target="chatFrame" method="post"> <input type="text" name="message" /> <input type="submit" /> </form> <script type="text/javascript"> function chatFrame(frameId) { var interval = setInterval(function() { document.getElementById(frameId).src = document.getElementById(frameId).src; }, 2000); } chatFrame('chatFrame'); //Еще прикрутить функцию для submit </script> chatFrame.php <?php //Запросы к бд сами echo 'Мы сообщения чата<br />'; if(isset($_POST['message'])) { echo $_POST['message']; } ?>
and ready)
|