Main Page

XML HTTP request object

In this chapter you learned all about JavaScript client-server communication. The chapter began with a
discussion of the oldest form of client-server communication involving JavaScript: cookies. You learned
that cookies are small pieces of data stored on the user ’s machine that can be used for a variety of pur-
poses. Because cookies are accessible to both the server and through JavaScript, this provides a unique
way for the two to communicate.
The chapter then moved on to make requests back to the server using hidden frames. The implementa-
tion of this technique using both hidden frames and iframes was discussed.
You then learned how newer browsers enable you to make HTTP requests directly back to the server
from JavaScript without the need for hidden frames. The XML HTTP request object was introduced, and
you learned how to send both GET and POST requests to the server. For those browsers that don’t sup-
port XML HTTP requests, you learned about using LiveConnect, the capability to interface with Java
from JavaScript, to send GET and POST requests.
Lastly, you learned how to create a cross-browser method of executing both GET and POST requests.
This method takes advantage of the browser ’s built-in capabilities, whether these use the XML HTTP
request or LiveConnect to make the requests.
Client-Server Communication
19_579088 ch16.qxd 3/28/05 11:42 AM Page 507

JavaScript EditorFree JavaScript Editor     Ajax Editor