Datasheet
Figure 1-3
Google Maps
Another part of Google’s dominant Ajax web applications is Google Maps (maps.google.com).
Designed to compete with well-established mapping sites, Google Maps uses Ajax to avoid reloading its
main page at all (see Figure 1-4).
Unlike other mapping web applications, Google Maps enables you to drag the map to move it in various
directions. The dragging code is nothing new to JavaScript developers, but the tiling of the map and
seemingly endless scrolling effect are another story. The map is broken up into a series of images that are
tiled together to make the appearance of a contiguous image. The number of images used to display the
map is finite, as creating new images every time the user moves the map would quickly lead to memory
problems. Instead, the same images are used over and over to display different segments of the map.
The client-server communication is done through a hidden iframe. Whenever you do a search or ask for
new directions, this information is submitted and returned within that iframe. The data returned is in
XML format and is passed to a JavaScript function (the Ajax engine) to handle. This XML is then used in
a variety of different ways: some is used to call the correct map images, and some is transformed using
XSLT into HTML and displayed in the main window. The bottom line is that this complex Ajax applica-
tion is, as of late 2006, the number two destination for mapping on the Web.
9
What Is Ajax?
04_109496 ch01.qxd 2/5/07 6:47 PM Page 9