Understanding Ajax and Web Services

Ajax is a collection of existing technologies and techniques for building browser-based applications. Ajax’s power centers on the JavaScript XMLHttpRequest object. This object can make data requests to a web server without redisplaying the entire web page. Couple this with JavaScript’s ability to dynamically modify the web page with DHTML and you have a powerful set of tools for improving the user experience.

Since Ajax retrieves data as XML it should pique the interest of web service users, since XML is lingua franca for almost all web services.

XML Is Optional

While it’s true that Ajax programs can retrieve XML data, it’s not a requirement of the XMLHttpRequest object. Your Ajax application can receive data in virtually any format. The needs of your application will largely dictate the data format. Popular data formats include JavaScript Object Notation (JSON), delimited text (such as tab-delimited and CSV formats), and XML.

Web services describe methods by which data is exchanged—usually between two computers. Today, the term “web services” almost always implies XML as the data format.

There are two popular web services access methods:

  • Simple Object Access Protocol (SOAP) uses XML-formatted messages to both send a request and receive a reply from a server. The SOAP XML format is standardized. SOAP is the most popular format used within large organizations, e.g., Google uses it for their search API.

  • Representational State Transfer (REST) requests ...

Get Ajax and Web Services 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.