Ajax besics

In this article I don't want to show you the history of AJAX and discuss its pros and cons, but only focus on how to create a basic working AJAX - PHP communication.

The only important thing at the moment is that AJAX uses JavaScript so it need to be enabled in your browser to successfully complete this tutorial.

To demonstrate the AJAX PHP connection we will create a very simple form with 2 input fields. In the first field you can type any text and we will send this text to our PHP script which will convert it to uppercase and sends it back to us. At the end we will put the result into the second input field. ( The example maybe not very useful but I think it is acceptable at this level. )

So let's list what we need to do:

Listen on key-press event on the input field.
In case of key-press send a message to the PHP script on the server.
Process the input with PHP and send back the result.
Capture the returning data and display it.

Comments

Popular posts from this blog

input stream or file to X509Certificate

How to rebase chain of git changes on master ?