Blog | Technical
So far we have seen a simple event occurring on a web page, an animated gif indicating some action is being taken and then some response returned and displayed on your page.
Our next step will be to type in some data in an input box and respond to the data on each key click. In this example we wish you to type in a town name and validate it against ones in our list.
First step then is to add an input text box:
However, this option only expects you to enter data which will then be passed into the system when you press the submit button.
We need to add an event handler everytime a key is pressed. To achieve this we add an event handler for `onkeyup`
Unfortunately this part is getting quite complicated due to the way the functions are called. In the next tutorial part 4 I will show how this can all be simplified, but for now lets go through the steps.
When you type in a Town Name then AjaxCall3 will call ajax_function3.php. This will validate the key presses and return a list of towns (if any in the list). This list will produce dynamic links calling AjaxCall4. The purpose of this set of fuctions is to select the town name you have clicked on and place it back into the Town Name Input Box.
Once you are complete you can press the Click Here button. This will call AjaxCall5 and ajax_functions5 to provide some fully validated output.
Again all this is acheived without reloading the complete page. The Ajax calls update a section on the page.
This is quite complex the way the function calls are setup. So in tutorial Part 4 I am going to replace the separate files by adding a CMD name function to each of the `ajax` calls. This means there will only be one AjaxCall event and also one file containing the ajax functions.
- Fake Emails and warnings
- Corresponding .uk domain names
- Web site management
- Pemalink web addresses
- What is AJAX ? a simple tutorial - Part 4
- What is AJAX ? a simple tutorial - Part 3
- What is AJAX ? a simple tutorial - Part 2
- What is AJAX ? a simple tutorial - Part 1
- phpChart examples
- Auction Web site