Introduction
In this chapter, we will look at the ways we can use JavaScript and YUI to retrieve and display data from a range of different sources. Using these techniques, we can integrate all types of data into our Moodle applications. This list includes weather forecasts, stock updates, news feeds, any type of custom text-based data you may have from external systems, and even data from Moodle itself (both the local Moodle system and any remote systems that your code is authorized to access), retrieved via Moodle's web services API.
Moodle 2.0 includes version 3 of the Yahoo! User Interface Library (YUI 3). YUI 3 has a rich data processing API which we will look at in this chapter. We will cover how to make a simple HTTP GET request to retrieve the contents of a file using the IO module, moving on to more complex scenarios such as retrieving data from an external domain, parsing a range of data formats, and the consumption of XML-based web services.