info343/minilabs/11/writeup.php

<section>
   <?= t_head('Convert to JSON', "5–10") ?>

   <p>Download the skeleton JavaScript file from Lab 5:</p>

   <p class="resource"><a href="http://courses.washington.edu/info343/labs/5/lightbox.js">http://courses.washington.edu/info343/labs/5/lightbox.js</a></p>

   <p>This is JavaScript code, but all it contains is a variable declaration with a complex object in it.</p>

   <p>Take that object and save it in a new file, <samp>images.json</samp>, and do whatever conversion necessary to make it valid JSON.</p>

   <p>You can validate your JSON code at any JSON formatter/validator listed in Lecture 12.</p>
</section>

<section>
   <?= t_head('Ajax Request to JSON file', '15–20') ?>

   <p>Now download the following skeleton files:</p>

   <p class="resource"><a href="minilab11.html">minilab11.html</a></p>
   <p class="resource"><a href="minilab11.js">minilab11.js</a></p>

   <p>Add the necessary JavaScript code to initiate an Ajax request to fetch your <samp>images.json</samp> file. Iterate over the image information in your JSON file, create <code>img</code> tags for each of them, and inject them into the page.</p>
</section>

<footer>
   <p>If you’ve finished everything, good job! Experiment with more complex JSON files.</p>
</footer>