O'Reilly logo

jQuery Mobile Cookbook by Chetan K Jain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using JSON content

JSON stands for JavaScript Object Notation. It is a lightweight data-interchange format and is very easy to use. This recipe shows you how to display the prices of Precious Metals from a JSON file.

Getting ready

Copy the full code of this recipe from the code/04/json-content sources folder. You can launch this code using the URL http://localhost:8080/04/json-content/main.html.

How to do it...

  1. Create the precious.json file containing an array of the five precious metals. The name, symbol, and the intraday open, close, high, and low prices are also available, as shown in the following code:
    [ { "name": "Gold", "symbol": "Au", "price": { "open": 1642.46, "close": 1682.42, "high": 1699.66, "low": 1638.51 } }, { "name": "Silver", "symbol": ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required