8. Communicating with the Server Through Ajax
In this chapter, we take a step into the world of Ajax. We extend code from previous chapters and take that codebase to the next level by interlacing it with a server communication layer to retrieve the data. More specifically, we take the JSON object you’ve been working with and move it to an external data file. Then we pull it in with a combination of user events (just like before) and Ajax calls to create another layer of separation where the data source is external to our normal stack of structure, presentation, and behavior. The data layer can be in almost any form from JSON (which is what we’re using) to a fully functional database.
In previous chapters, we mentioned Ajax briefly, but in this ...
Get Learning JavaScript: A Hands-On Guide to the Fundamentals of Modern JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.