Summary
In this chapter, we introduced Ajax, a collection of web techniques to asynchronously collect data from the server. It is used to update only parts of the screen on websites and web applications, rather than loading an entirely new page each time.
Ajax techniques are based on the XMLHttpRequest object, but thanks to jQuery and its $.ajax()
methods, you learned how to use Ajax in your applications without having to know anything about that object. We used the $.load
and $.post
methods in our examples to replace parts of our screen with HTML that is either stored or generated on the server.
Ajax can be used with other data formats, such as XML and JSON. It also has potential drawbacks, because now that we constantly update the page without actually leaving it, it will be perceived as different pages by the visitor of our site, particularly when they press the browser's back button.
These two topics: making the back key do what is expected of it, and using different data formats between...