2.4. Summary

This chapter introduced you to several Ajax techniques for client-server communication. It began with an HTTP primer, exploring HTTP requests and responses. You learned about the format of HTTP messages and the differences between a GET request and a POST request. The concepts of headers and message bodies were introduced.

The first Ajax technique you learned was the hidden frame technique, which uses a frame with a width or height of zero, effectively hiding it from the user. This technique uses JavaScript calls to and from the hidden frame to facilitate the client-server communication. Using the hidden frame technique, you learned how to send both GET and POST requests.

Next, you learned about replacing hidden frames with hidden iframes. Because iframes can be created dynamically using JavaScript, this may be a preferable way to initiate client-server communication in modern browsers. The same techniques were used as with hidden frames, although iframes provide a bit more flexibility in the design of your pages.

The chapter also introduced the use of XHR for client-server communication. You learned that Internet Explorer, Mozilla Firefox, Safari, and Opera all support some form of XHR object, and some extra coding is necessary to detect these differences. The differences between asynchronous and synchronous requests were explained, and you learned how to make GET and POST requests using XHR. You also learned how to use request and response headers along with HTTP status codes to better handle requests.

You learned about two alternate Ajax techniques using images and dynamic script loading. It was discussed how these two techniques allow cross-domain communication, unlike XHR and hidden frames. Two different methods of using images were covered and the advantages and disadvantages of each were discussed.

The last topic covered in this chapter was cache control and its importance in Ajax. You learned to always set the cache control headers to avoid possible caching-related issues.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset