Advertisement
mttprvst13

Chatroom Javascript

Jul 30th, 2015
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getChat(id){
  2.     //alert("test");
  3.     $.ajax({url: "chatroomlistener.php"}).done(function(msg) {
  4.         //alert(msg);
  5.         $('#' + id).html(msg);
  6.     });
  7.    
  8. }
  9.  
  10. function sendChat(){
  11.    
  12.     var chat = document.getElementById("chat").value;
  13.     var name = document.getElementById("name").value;
  14.    
  15.     var formdata = {chat : chat, name: name};
  16.    
  17.     $.ajax({
  18.         url: "chatroomlistener.php",
  19.         type: "post",
  20.         data: formdata
  21.     });
  22.    
  23.     document.getElementById("chat").value = '';
  24.    
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement