Blog | Technical

What is AJAX ? a simple tutorial - Part 2

The first part of my tutorial was very basic and I intend to follow through some further steps to enhance the users view of data input and selection.

This second part covers some immediate feedback of user interaction. In the first part it is not obvious if anything has occurred especially if the processing were to take some time (even a few seconds).

What we require to do is provide some visual interaction that the suystem is processing. For this example I am going to add an animated gif as soon as the user has pressed the button.

this is achieved quite simply by adding the folloing line to the AjaxCall function:


document.getElementById(name).innerHTML="< img src=`loading.gif`
alt=`Please wait....`>" ;


This is shown in the following page: https://2mx.co.uk/ajax/index2.php

When you press the button you will see an animated gif for a few seconds followed by the text and date/time being updated.

/news.php :: /news.php?c=Blog&sc=Technical&ID=2324