jQuery in Action
Loading content into elements
229
8.2.2 Loading dynamic inventory data
Often in business applications, particularly for retail web sites, we want to grab
real-time data from the server to present our users with the most up-to-date infor-
mation. After all, we wouldn't want to mislead customers into thinking that they
can buy something that's not available, would we?
real-time data from the server to present our users with the most up-to-date infor-
mation. After all, we wouldn't want to mislead customers into thinking that they
can buy something that's not available, would we?
In this section, we'll begin to develop a page that we'll add onto through-
out the course of the chapter. This page is part of a web site for a fictitious firm
named The Boot Closet, an online retailer of overstock and closeout motorcy-
cle boots. Unlike the fixed product catalogs of other online retailers, this inven-
tory of overstock and closeouts is fluid, depending on what deals the proprietor
was able to make that day and what's already been sold from the inventory.
So it will be important for us to always make sure that we're displaying the lat-
est info!
named The Boot Closet, an online retailer of overstock and closeout motorcy-
cle boots. Unlike the fixed product catalogs of other online retailers, this inven-
tory of overstock and closeouts is fluid, depending on what deals the proprietor
was able to make that day and what's already been sold from the inventory.
So it will be important for us to always make sure that we're displaying the lat-
est info!
To begin our page (which will ignore site navigation and other boilerplate to
concentrate on the lesson at hand), we want to present our customers with a drop-
down containing the styles that are currently available and, on a selection, display
detailed information regarding that style to the customer. On initial display, the
page will look as shown in figure 8.2.
down containing the styles that are currently available and, on a selection, display
detailed information regarding that style to the customer. On initial display, the
page will look as shown in figure 8.2.
After the page first loads, a pre-loaded dropdown with the list of the styles cur-
rently available in the inventory and labeled fields to show the item data when a
Figure 8.2 The initial display of our item information page