Chapter 2. Getting Started


In this chapter

2.1 XMLHttpRequest Overview

page 16

2.2 Cross-Browser XMLHttpRequest

page 21

2.3 Sending Asynchronous Requests

page 23

2.4 AJAX Without XMLHttpRequest

page 29

2.5 Fallback Option 1: Sending a Request Using an IFrame

page 31

2.6 Fallback Option 2: Sending a Request Using a Cookie

page 36

2.7 Summary

page 39


The foundation that makes AJAX possible is the communication layer with the server. The most complete option for performing this communication is the JavaScript XMLHttpRequest object. If XMLHttpRequest is not suitable to you, hidden IFrames and cookies can also be used. We will examine both options later in this chapter.

This chapter introduces you to the XMLHttpRequest object, showing you how to work around its implementation differences between browsers. After that, we make some actual page requests, both in a synchronous fashion and in an asynchronous fashion. This chapter finishes with some various fallback approaches that can be used if a browser doesn't support XMLHttpRequest, including how to use IFrames and cookies as your communication channel.




Understanding AJAX(c) Using JavaScript to Create Rich Internet Applications
Understanding AJAX: Using JavaScript to Create Rich Internet Applications
ISBN: 0132216353
EAN: 2147483647
Year: N/A
Pages: 154

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net