Java Reference
In-Depth Information
XML
When the term Ajax was originally coined, XML documents were often used to re-
turn data. Many different types of data can be sent, but by far the most commonly
used in Ajax nowadays is JSON, which is more lightweight and easier to parse than
XML. (Although it has never really taken off, the term Ajaj is sometimes used to
describe the technique.) JSON also has the advantage of being natively supported in
JavaScript, so you can deal with JavaScript objects rather than having to parse XML
files using DOM methods.
Ajax use really started to take off. Now users could see new content on web pages without
having to refresh the page. Shopping baskets could be updated in the background, partial
page content could be loaded seamlessly, and photo galleries could dynamically load im-
ages.
Today, it's unusual for Ajax not to be used when a partial web page update is required. The
explosion in the use of public APIs also means that Ajax is used more then ever to transport
data back and forth between sites.
Note: What is an API?
An application programming interface (API) is a collection of methods that
allow external access to another program or service. Many websites allow
controlled access to their data via public APIs. This means that developers
are able to interact with the data and create mashups of third-party services.
A weather site, for example, might have an API that provides methods that
return information about the weather in a given location, such as temperat-
ure, wind speed, and so on. This can then be used to display local weather
data on a web page. The information that's returned by APIs is often seri-
alized as JSON. Since the data is being provided by an external site, CORS
will have to be enabled in order to access information from an API. Some
services may also require authentication in order to access their APIs.
Search WWH ::




Custom Search