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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.