Chapter 7. Communicating with the server

This chapter covers

  • The server’s role in an SPA environment
  • How MV* frameworks communicate with the server
  • Handling results with callback functions and promises
  • Consuming RESTful services

In chapter 1, you learned how the adoption of the XMLHttpRequest (XHR) API and the AJAX movement eventually led to the emergence of SPAs. After XHR was supported in the browser—as a COM component at first and then natively—developers could use it to asynchronously load both the application’s scaffolding and its data without refreshing the page. This opened many new avenues for the ways that web pages could be constructed.

Until now, you’ve been focusing on creating the SPA itself. In doing so, you’ve used XHR ...

Get SPA Design and Architecture 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.