First time I heard about ajax it seems to be something very complicate, but
it depends on what do you want to achieve.
So there are several ajax libraries like script.aculo.us. But there are some more simple, I use XHConn library.
Ajax concept is based on XMLHttpRequest() javascript object which let you to load contents on a page without need to reload the entery page.
To develop simple pages using this library is needed XHConn.js and include_to.js files. Then imagine you have an index.php page with a textbox and a button. We want to load content in the textbox in a div.
index.php
What's you name?
In the head of the page we have needed libraries. Then in the boby an input text whose id is “name” and a button with an onclick property that contains the include_to function:
First parameter are the variables we send to the server, the second one is the page we send it to, the third is the destination where we load that page and the last is the image loader by default spinner.gif if empty.
Function getValue() in the first parameter returns the value of the element with passed id. In that case it returns the name we set in the input text box.
feedback.php
echo "My name is ".$_POST["name"].".";
?>
This page just echo’s the name.
Download example files here.
See it online.