What it isn't is the World's Most Full-Featured Chat Room. We'll create a "Chat" function that is parent to a bunch of other functions for dealing with Chat-related stuff.update Chat will ask the server if there are new lines in the text file.The function will pass that data to the server to do what it will with it.get State Of Chat asks the server basically how many lines the current text file is, so it has something to compare against and know when lines are "new" or not. And those functions look like: All three of these functions make use of j Query's AJAX abilities, and do their communicating with a PHP file called process.php, which of course we'll need to build!When we send, the message is processed and then written into the text file as a new line.We're going to need to do some Java Script stuff to get this party started.As such, the first thing we'll do is snag that value and set up a switch statement that covers each possible function.
The group chat rooms are a fun place to hang out and talk with friends and random people.
Part of the data that gets passed with the AJAX calls is an (arbitrary) value named "function".
This is just to let the PHP file know what kind of thing we need done.
We need to use the "update" function of our chat to poll the text file for new messages and append them if necessary.
So we'll need to call that update function on a regular basis, and we'll use Java Script's set Interval() function for that: Download Files Note: Remember this is PHP powered, so you can't just download the files and open them on your local machine and have it work, unless you are running a local PHP server.