4. Data Formats

What's Your Poison?

Ajax is language agnostic, at least on the server. It doesn't matter what server-side language you use for your business logic. However, when you are requesting data from the server, the data that's sent from the server must be formatted in a way that the browser can understand. Your server-side programming language of choice needs to return data in one of three ways: XML, JSON, or HTML. In this chapter, I'm going to examine each data format so that you can make an informed decision as to which one best suits your needs.

XML

Back when the term AJAX was an acronym, it stood for Asynchronous JavaScript and XML. XML also figures prominently in the name of the XMLHttpRequest object. You would be forgiven for ...

Get Bulletproof Ajax 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.