Ajax 4 PHP and ASP

Step 1 – Ajax basics
________________________________________
Ajax PHP tutorial
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.
Our html code is very simple it looks like this:
Download the file for complete picture:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s