Chapter 8. Communicating with Servers

In this chapter, we're going to cover the following topics:

  • Creating an HTTP GET request to fetch JSON
  • Creating a request with custom headers
  • Versioning your API
  • Fetching JSON data with JSONP
  • Reading XML data from the server
  • Using the FormData interface
  • Posting a binary file to the server
  • Creating an SSL connection with Node.js
  • Making real-time updates with Ajax Push
  • Exchanging real-time messages using WebSockets

Creating an HTTP GET request to fetch JSON

One of the basic means of retrieving information from the server is using HTTP GET. This type of method in a RESTful manner should be only used for reading data. So, GET calls should never change server state. Now, this may not be true for every possible case, for example, ...

Get HTML5 Data and Services Cookbook 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.