AJAX and user interraction


When you build AJAX applications the goal is to make them more convenient and accessible for the user.
One way to do this is via change in the cursor style from normal to waiting hourglass while the application performs its query to the server. This will automatically inform the user that the page is loading and one must wait.
Here is how to accomplish this via 2 JavaScript DOM lines that will inject css rule to the body tag and later clear it.

HOW:
In your application when loading, next to the display of the waiting status image place:

document.getElementsByTagName("body").item(0).style.cursor="wait";
Next when the application is ready and the waiting image is cleared restore the cursor style:
document.getElementsByTagName("body").item(0).style.cursor="auto";
For a comprehensive explanation behind the new web2 applications look at this modified AJAX diagram.

Cheers!

0 коментара: