Guest User

Untitled

a guest
Feb 21st, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ?>
  4.  
  5. <html>
  6. <head>
  7. <script>
  8. <?php
  9. include("jquery.js");
  10. ?>
  11.  
  12. function sendMessage()
  13. {
  14. $.ajax({
  15. type: "POST",
  16. url: "post.php",
  17. async: false,
  18. data: "message="+$("#myMessage").val(),
  19. success: function(msg){
  20. refreshChat();
  21. }
  22. });
  23. },
  24.  
  25. function refreshChat()
  26. {
  27. $.ajax({
  28. type: "POST",
  29. url: "loadchat.php",
  30. success: function(msg){
  31. $("#chatArea").html(msg);
  32. }
  33. });
  34. }
  35. </script>
  36. </head>
  37. <body>
  38. <table>
  39. <tr>
  40. <td>
  41. <div id=”chatArea”></div>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td>
  46. <textarea id=”myMessage”></textarea>
  47. </td>
  48. </tr>
  49. <tr>
  50. <td>
  51. <input type="button" VALUE="Send" onClick="onclick=”sendMessage();” style="margin: 0px;">
  52. <?php echo $_SESSION['username']; ?>
  53. </td>
  54. </tr>
  55. </table>
  56. </body>
  57. </html>
Advertisement
Add Comment
Please, Sign In to add comment