08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 11 ■ <strong>AJAX</strong> APPLICATIONS AND EMPOWERING THE WEB USER EXPERIENCE 275<br />

Figure 11-9. Browsing to the next bicycle<br />

The entire code for the page is shown in Listing 11-4.<br />

Listing 11-4. Forward-Caching Client<br />

<br />

<br />

<br />

<strong>AJAX</strong> Picture Client<br />

<br />

var ajaxRequest<br />

var cachedAjaxRequest<br />

var currentPic = 100;<br />

var theURL;<br />

var theCachedURL;<br />

function init<strong>AJAX</strong>()<br />

{<br />

try<br />

{<br />

ajaxRequest = new XMLHttpRequest();<br />

cachedAjaxRequest = new XMLHttpRequest();<br />

}<br />

catch(error)<br />

{<br />

ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!