Here we are going to make a simple chat engine using little Jscript, AJAX and back-end PHP. At the end of the tutorial, you will be able to make a chat engine of your own. This example will also make you able to use AJAX in your various purposes. Please follow step by step to understand properly.

We will first develope a simple text box which will be non-editable to show the contents of the chat


readonly attribute insures that no one will be able to edit the contents of the chat. We now will try to have a send button and a javascript function which will send the chat on pressing enter i.e. we are two way mode for communication, either Enter or clicking send button.We will be having a form for its implementation


We have set the submit action of the form to false so that the page doesn't load again whenever the user submits the form. Function searchKeyPress will be triggered whenever a key is pressed. It checks whether the key was a return key. The main chat button also has a onClick event handler which responds whenever one presses the Chat button.

Once we are done with the form part, lets move to the Jscript and Ajax part which acts as main engine in our chat.

Member Login

Member Login

Not a Member? Sign Up!

Login to comment

Be the first to comment on this topic


<<< Wanna review

Continue >>>