O'Reilly logo

HTML5 Data and Services Cookbook by Mite Mitreski, Gorgi Kosev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required