title: Parse JSON YQL Output with jQuery append to IDs
body: <p>I have a YQL output JSON string at this URL: <a href="http://query.yahooapis.com/v1/public/yql?q=select%20%2a%20from%20html%20where%20url=%22http://www.missoulaavalanche.org/current-advisory/%22%20and%20xpath=%27//div%5B@id=%22content%22%5D/div%5B1%5D%27&amp;format=json&amp;callback=cbfunc" rel="nofollow">YQL JSON</a></p>
  
  <p>I found some other </p>
  
  <p>I am trying to understand why I cannot get certain items out of the JSON return. For example, using jQuery, if I want the first DIVs H1 I use:</p>
  
  <pre><code>$.ajax({
         url:"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Fwww.missoulaavalanche.org%2Fcurrent-advisory%2F%22%20and%20xpath%3D'%2F%2Fdiv%5B%40id%3D%22content%22%5D%2Fdiv%5B1%5D'&amp;format=json",
         dataType: 'jsonp',
         jsonp: 'callback',
         jsonpCallback: 'cbfunc'
      });
      function cbfunc(data){
        var id = data.query.results.div;
  
        $('#table').append('&lt;li&gt;'+id.h1+'&lt;/li&gt;');
  
    $('#table').listview('refresh');
  }       
  </code></pre>
  
  <p>I have tried to get some info, say the img alt or img src, from the second div... div<a href="http://query.yahooapis.com/v1/public/yql?q=select%20%2a%20from%20html%20where%20url=%22http://www.missoulaavalanche.org/current-advisory/%22%20and%20xpath=%27//div%5B@id=%22content%22%5D/div%5B1%5D%27&amp;format=json&amp;callback=cbfunc" rel="nofollow">1</a> like so:</p>
  
  <pre><code>function cbfunc(data){
        var id = data.query.results.div[1];
  
        $('#table').append('&lt;li&gt;'+id.img.alt+'&lt;/li&gt;');
  
        $('#table').listview('refresh');
      }
  </code></pre>
  
  <p>I keep getting Undefined or no results... What I am missing or not understanding about getting results from the yql JSON list? </p>
  
  <p>EDIT: I read a post on the <a href="http://www.yqlblog.net/blog/2010/03/12/avoiding-rate-limits-and-getting-banned-in-yql-and-pipes-caching-is-your-friend/" rel="nofollow">YQL Blog about Cache busting</a>... So I am using their suggestion there.</p>
  
  <p>EDIT 2: here is the JSON from the yql. I would like to get div img src for example, but am not getting a return or I get an object. I think it would be data.query.results.div<a href="http://query.yahooapis.com/v1/public/yql?q=select%20%2a%20from%20html%20where%20url=%22http://www.missoulaavalanche.org/current-advisory/%22%20and%20xpath=%27//div%5B@id=%22content%22%5D/div%5B1%5D%27&amp;format=json&amp;callback=cbfunc" rel="nofollow">1</a>.img.src</p>
  
  <p>I get data.query.results.div.h1 no problem:</p>
  
  <pre><code>cbfunc({
   "query": {
    "count": 1,
    "created": "2012-03-28T15:36:28Z",
    "lang": "en-US",
    "results": {
     "div": {
      "id": "content",
      "div": [
       {
        "class": "post-2491 post type-post status-publish format-standard hentry category-advisories",
        "id": "post-2491",
        "h1": "March 26, 2012 Avalanche Advisory",
        "p": {
         "class": "postmetadata alt",
         "small": {
          "br": [
           null,
           null
          ],
          "a": {
           "href": "http://www.missoulaavalanche.org/category/advisories/",
           "rel": "category tag",
           "title": "View all posts in Advisories",
           "content": "Advisories"
          },
          "content": "This entry was posted on Monday, March 26th, 2012 at 6:55 am\n Categories: \n"
         }
        },
        "div": [
         {
          "id": "danger_rating",
          "a": {
           "href": "http://www.missoulaavalanche.org/wp-content/themes/missoula-avalanche/images/ratings/avalanche_danger_scale.jpg",
           "img": {
            "alt": "Current Danger Rating is MODERATE",
            "src": "http://www.missoulaavalanche.org/wp-content/themes/missoula-avalanche/images/ratings/moderate.gif"
           }
          }
         },
         {
  </code></pre>