HTML and CSS Reference
In-Depth Information
Usually, AJAX is associated with server-side applications. For example, you can create a
search engine and then use AJAX to retrieve search results and present them without ever
leaving the current page. Unfortunately, there's not enough space in this topic to teach
you how to create a search engine. jQuery provides the ability to retrieve information
from a different static page using AJAX and present it in the current page. I'm going to
present an example that takes advantage of that feature to show you how AJAX can be
Using AJAX to Load External Data
I've created a simple page, shown in Figure 16.16, that allows users to look up informa-
tion about South American countries. When a user clicks one of the links, the informa-
tion about that country is retrieved from the server and displayed inline on the page.
Because of the way AJAX works, this example will work only if it's
deployed on a web server. If you load the files directly in your
browser, the JavaScript code that retrieves the information won't
The sample consists of two files. The first is the page shown in Figure 16.16, which
loads the data from the second page.
FIGURE 16.16
A page that loads
data from an exter-
nal source using
Search WWH ::

Custom Search