diff --git a/src/chat.php b/src/chat.php index 2bf5f8f..c3ed109 100644 --- a/src/chat.php +++ b/src/chat.php @@ -1,6 +1,7 @@ $(document).ready(); + //wipes data on the front end and back end function wipeData(){ $.ajax({ url : "wipe.php", @@ -57,6 +59,7 @@ function(data){ }); } + //counts characters and updates div function charCount() { var text = document.getElementById("message").value; var length = text.length; @@ -67,6 +70,7 @@ function charCount() { } window.setInterval(charCount, 250); + //checks with server script to get updated messages and renders them appropriately function refreshData() { $.ajax({ url: "updateData.php", @@ -108,6 +112,7 @@ function(data){ $(divTime).html(time); $(divNum).html(num); + //handles alignment based on the sender if(real_name == name){ $(divMessage).css({"font-weight": "bold", "text-align" : "right", "padding-right" : "25px"}); $(divInfo).css({"font-weight": "bold", "text-align" : "left"}); @@ -124,10 +129,11 @@ function(data){ } window.setInterval(refreshData, 250); - + //sends message to database and renders updated messages function sendMessage(){ var text = document.getElementById("message").value; + //not being used currently var alert = ""; if(text == ""){ alert = "Cannot send a blank message"; @@ -397,15 +403,12 @@ function(data){ -