Skip to Main Content
JavaScript and Open Data
book

JavaScript and Open Data

by Robert Jeansoulin
August 2018
Intermediate to advanced content levelIntermediate to advanced
272 pages
5h 3m
English
Wiley-ISTE
Content preview from JavaScript and Open Data

10AJAX Technology (Asynchrony)

This chapter deals with synchronous and asynchronous processing.

Programming in the web ecosystem, that is to say, in the context the Internet, means that the speed of communication and the volume of exchanged data impact the processes. Response time can vary, and an absence of response may block a process. JavaScript is run in “single thread”, hence one single blocking operation may block the whole application: we need another mechanism for creating a request and handling the return (“callback”) into the event loop previously described (section 8.5).

10.1. Architecture for client-server data exchange

Dynamically adding elements in a web page traces back to 1996, with the <iframe>. In 1998, Microsoft introduced a more general solution with the ActiveX controls, then in the form of the object XMLHttpRequest in Internet Explorer. In 2005, that object was standardized by ECMA and was popularized under the name Asynchronous Javascript And XML (AJAX).

The client-side script program can post a HTTP request and then continue its activity without being blocked. When the mechanism is able to tell that an answer (or an error) is ready, the callback function can be run, on that response, in a similar manner to that of the processing of DOM events.

Beyond the ability to modify only part of the web page, avoiding a complete reload (including many unchanged elements), AJAX also allows access to the data files, under a variety of formats (primarily XML), served ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Wrangling with JavaScript

Data Wrangling with JavaScript

Ashley Davis
Web Applications with Javascript or Java

Web Applications with Javascript or Java

Gerd Wagner, Mircea Diaconescu

Publisher Resources

ISBN: 9781786302045