AJAX - The Complete Reference

(avery) #1

PART II


Chapter 9: Site and Application Architecture with Ajax 469


Next, the user selects a category that invokes a function to send an Ajax request to select
the photos in the clicked category. The history system is invoked to set the URL to include
the section indicator. In this case, only the data necessary to re-request the file list is saved,
but we could also have indicated to cache the response value instead.

Next, the user selects one of the pictures. Upon clicking, the page displays a thumbnail
of the particular image they are interested in. Since XHRs cannot transmit binary
information, an <img> tag is created instead and it’s src is set to the URL of the thumbnail in
question. Yet because an XHR request was not used here, the history mechanism must be
manually updated with a call to AjaxTCR.history.addToHistory(), and the key is set to
show the section and image in question.
Free download pdf