title: Uncaught TypeError: Cannot read property 'length' of undefined
body: <p>I'm working on a jquery mobile script to get json from my wordpress site but its not displaying anything and returns with a: 'Uncaught TypeError: Cannot read property 'length' of undefined' error. I know i'm messing up somewhere with parsing the json, but i happen to be a javascript noob. To the guy that both fixes and explains it to me, i thank you.</p>
  
  <p>HTML:
  ListView</p>
  
  <pre><code>    &lt;div data-role="page" id="home"&gt;
  &lt;div data-role="content"&gt;
          &lt;div class="example-wrapper" data-iscroll&gt;
              &lt;ul data-role="listview" id="post-list" data-theme="a"&gt;&lt;/ul&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>PageView</p>
  
  <pre><code>&lt;div data-role="page" id="headline"&gt;
   &lt;div data-role="content"&gt;
          &lt;ul data-role="listview" id="post-data" data-theme="a"&gt;&lt;/ul&gt;
      &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>JavaScript:</p>
  
  <pre><code> $(document).on('pageinit', '#home', function () {
  
                     $.ajax({
                            url: 'http://chris.floppytron.com/api/get_recent_posts/',
                            dataType: "jsonp",
                            success: function (result) {
                            ajax.parseJSONP(result);
                            },
                            error: function (request, error) {
                            alert('Network error has occurred please try again!');
                            }
                            });
                     });
  
                     $(document).on('pagebeforeshow', '#headline', function () {
                                    $('#post-data').empty();
                                    $.each(postInfo.result, function (i, row) {
                                           if (row.id == postInfo.id) {
                                           $('#post-data').append('&lt;li&gt;' + row.title + '&lt;/li&gt;');
                                           $('#post-data').append('&lt;li&gt;' + row.date + '&lt;/li&gt;');
                                           $('#post-data').append('&lt;li&gt;' + row.categories + '&lt;/li&gt;&lt;br /&gt;');
                                           $('#post-data').append('&lt;li&gt;' + row.content + '&lt;/li&gt;');
                                           $('#post-data').listview('refresh');
                                           }
                                           });
                                    });
  
                                    $(document).on('vclick', '#post-list li a', function () {
                                                   postInfo.id = $(this).attr('data-id');
                                                   $.mobile.changePage("#headline", {
                                                                       transition: "slide",
                                                                       changeHash: false
                                                                       });
                                                   });
  
                                                   var postInfo = {
                                                       id: null,
                                                       result: null
                                                   }
  
  var ajax = {
      parseJSONP: function (result) {
          postInfo.result = result.results;
          $.each(result.results, function (i, row) {
                 console.log(JSON.stringify(row));
                 $('#post-list').append('&lt;li&gt;&lt;a href="" data-id="' + row.id + '"&gt;&lt;img src="' + row.thumbnail + '"/&gt;&lt;h3&gt;' + row.title + '&lt;/h3&gt;&lt;p&gt;' + row.categories + '&lt;/p&gt;&lt;br /&gt;&lt;p&gt;' + row.date + '&lt;/p&gt;&lt;/a&gt;&lt;/li&gt;');
                 });
                 $('#post-list').listview('refresh');
      }
  }
  </code></pre>