This first example shows how timing of AJAX events may, if you wish, influence a page's contents. It also shows how to correctly create customized AJAX callback functions.
The second example is a broken example. It illustrates a subtle aspect of variable scoping in JavaScript. This is example presented as a cautionary tale of now not to write simple correct AJAX code.
There is a Zip File containing these examples.