Interact with JavaScript Web Data


show more Interacting with JavaScript provides you with in-depth training on Developer. Taught by Joseph Lowery as part of the Working with Data on the Web show less
please wait ...

Interacting with JavaScript

JSON is pretty popular nowadays, in version 1.1 of their API, Twitter switched to exclusive support for JSON. And all major social media platforms work with the format as well. So, just how do you bring in your own JSON data into your webpage? I'll show you all the steps necessary in this lesson. But before we get to coding, let's take a look at an example JSON data file. On the screen now, is data.json from the Chapter 4, 04, 02 folder of the exercise file.

The root JSON object is paintings. Which is a collection of other adjacent objects. Each called painting as you see starting on line three. Each painting in turn has a number of key value pairs, for example on lines five, six, seven, and eight. Now let's turn to index.htm in the same folder. We can use JQuery to read in our data and insert it with any desired HTML and JavaScript code. Best of all, we can do this asynchronously using JQuery's AJAX method.

Let's add our code right after the call that includes JQuery. We'll begin...

Interacting with JavaScript
Video duration: 11m 10s 2h 21m Intermediate

Viewers:

Interacting with JavaScript provides you with in-depth training on Developer. Taught by Joseph Lowery as part of the Working with Data on the Web

Subjects:
Developer Web
Software:
HTML XML CSS JSON YAML
Author:
please wait ...