title: Iterate JSON to create innerHTML links
body: <p>Alright I've been scouring Stack Overflow for a while now but can't seem to find the solution to my problem.  I'm trying to iterate through the JSON to pull all the <code>ids</code> and <code>dates</code> in each <code>top_worst</code> section.  The JSON looks like this:</p>
  
  <pre><code>[
  {
      "timerName": "FT:Tree",
      "top_worst": [
          {
              "id": 44083,
              "date": "2015-07-14T21:31:58+00:00"
          },
          {
              "id": 44059,
              "date": "2015-07-14T20:00:58+00:00"
          },
          {
              "id": 44119,
              "date": "2015-07-14T23:30:31+00:00"
          },
          {
              "id": 44065,
              "date": "2015-07-14T20:20:46+00:00"
          },
          {
              "id": 43981,
              "date": "2015-07-14T15:20:50+00:00"
          }
      ],
      "daily_percentile_90th": 26651,
      "daily_average": 22076
  },
  {
      "timerName": "Search:Blog",
      "top_worst": [
          {
              "id": 44087,
              "date": "2015-07-14T21:28:48+00:00"
          },
          {
              "id": 44087,
              "date": "2015-07-14T21:22:54+00:00"
          }
      ],
      "daily_percentile_90th": 9248.1,
      "daily_average": 9040.5
  },
  {
      "timerName": "Search:ViewImage",
      "top_worst": [
          {
              "id": 44152,
              "date": "2015-07-15T01:04:53+00:00"
          },
          {
              "id": 44092,
              "date": "2015-07-14T21:41:27+00:00"
          },
          {
              "id": 44230,
              "date": "2015-07-15T05:22:44+00:00"
          },
          {
              "id": 44074,
              "date": "2015-07-14T20:40:57+00:00"
          },
          {
              "id": 44098,
              "date": "2015-07-14T22:03:25+00:00"
          }
      ],
      "daily_percentile_90th": 6545.6,
      "daily_average": 5571.49
  }
  ]
  </code></pre>
  
  <p>So the problem is that my for-loop causes issues because not all of the timers have a top_worst section, so it throws an error when I try to use <code>.length</code> in the for-loop.  The goal is to get a link inside the table cell using the id as part of the link, and then using the date as the visible part.  See image below if you are confused (don't worry, I am too, clearly).  Here is my HTML code so you can see what's going on:</p>
  
  <pre><code>function createTable(jsonData){
  $.each(jsonData, function(i, item){
  
      var daily90th = (item.daily_percentile_90th/1000).toFixed(2);
      var dailyAverage = (item.daily_average/1000).toFixed(2);
  
      var $tr = $("&lt;tr class='clickable'&gt;").append(
          $("&lt;td align='left'&gt;").text(item.timerName),
          $("&lt;td class='daily90'&gt;").text(daily90th),
          $("&lt;td class='dailyAvg'&gt;").text(dailyAverage)).appendTo("#reportTable");
  
      var $ta = $("&lt;tr id='spaces"+(i)+"'&gt;").append(
          $("&lt;td id='createLinks"+(i)+"'&gt;")).appendTo("#reportTable");
  
  
          var where = document.getElementById('createLinks'+(i));
          where.innerHTML = "&lt;a href='http:/example.com/example.html?id=44217'&gt;2015-07-15T04:43:49+00:00&lt;/a&gt;";            
  
  });
  } 
  </code></pre>
  
  <p>Any help on this at all would be great!!!  Here's a fiddle too: <a href="http://jsfiddle.net/rg2s7Lqk/1/" rel="nofollow noreferrer">http://jsfiddle.net/rg2s7Lqk/1/</a></p>
  
  <p>This is what it looks like on my site, but instead of one static link, I need to dynamically create them.</p>
  
  <p><img src="https://i.stack.imgur.com/DNUae.jpg" alt="This is what it looks like on my site, but instead of one static link, I need to dynamically create them."></p>
  
  <p>THANKS YOU GUYS!!!!</p>