Datasheet

FIGURE 1.7
An Ajax-enabled calculator
Talk with Ajax chat applications
Ajax is great anywhere intensive updating is required, such as chat applications, where any number
of users can type and their text appears automatically to everyone currently logged in. Ajax is a
good choice here because the text being displayed is always being updated, and having to watch it
flicker as the whole page is updated would be very annoying.
Using Ajax, however, you can update text anywhere in a page easily, no page refresh required. Take
a look, for example, at
www.phpfreechat.net/demo.en.php, the PHP Free Chat page. This
page connects to a PHP script on the server to support a chat application. When you first navigate
to PHP Free Chat, it asks you to enter a username, as you see in Figure 1.8.
FIGURE 1.8
Signing in for PHP Free Chat
After you’ve signed in, you can type your text in the text field that appears at the bottom of Figure
1.9; when you press Enter, that text is sent, using Ajax, to the server, which adds that text to the
text that others have typed, and the results appear in the chat box, as you can see in Figure 1.9.
10
Fundamental Ajax
Part I
06_102633 ch01.qxp 2/23/07 9:44 PM Page 10