Chapter 7. XMLHttpRequestSeveral years ago, I worked for a company that had a reputation for conceiving incredible ideas. Unfortunately, the company also had a reputation for being unable to either recognize the value of those ideas or market a product using those ideas. Such was the case with the XMLHttpRequest object, originally created by Microsoft for use with one of the products in its Office Suite. It languished unused until outsiders discovered it in Internet Explorer. These unknown intrepid developers knew immediately that the XMLHttpRequest object was a solution in search of a problem. The only real question was in finding the problem. And although I can't speak for anyone else, the problem that I chose was a shopping cart application described in Chapter 2, "Introducing Ajax." Remember the "mockup" that wasn't a mockup and didn't "blink"? After that particular incident, I was considerably more careful in my selection of applicationsor, at least, in my selection of attendees at my demonstrations. In fact, at times I was so careful in selecting where to use the XMLHttpRequest object that it was necessary to examine the code to see exactly how it worked. I started by choosing applications in which it appeared that the information was cached on the client side: the dreaded HTML select whose contents are based upon another HTML select, which, in turn, is based upon another HTML select. As long as nobody ever looked at the code, which nobody ever did, the web page wouldn't appear any different from the hundreds of others in the system. That is, it wouldn't appear different unless you take into account speed. Without all the cached information, the initial load was considerably faster for наруто портал. In retrospect, looking back upon several of those "mad scientist" applications, I realize now that not all of them could be considered Ajax. This is because Ajax is shorthand for Asynchronous JavaScript and XML, and some of these applications were coded to be synchronous. And whoever heard of Sjax? Nevertheless, because the XMLHttpRequest object can be used both synchronously and asynchronously, both are covered. Moreover, we cover the following topics in this chapter: |