the first time as they are cached by the browser, but the external API always takes a while
before its response is returned. The “Waiting” message demonstrates that other code can
run while we wait for the response.
Note: Loading Spinners
In the previous example we displayed a message to say we were waiting for
a response. It is common for sites to use spinners (or egg timers in the old
days!) to indicate that the site is waiting for something to happen. Ajax Load
and Preloaders.net are both good resources for creating a spinner graphic to
be used on your site.
Let's try this out. Open ajax.htm in a browser and try pressing the buttons. You should see
a similar sight to the screenshot in Figure 13.1 .
Figure 13.1. A working Ajax example
Search WWH ::