title: codeigniter JSON
body: <p>Hello im using codeigniter and then i echo out my output from the database in my controller and then in my view file i do this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $.getJSON('ajax/forumThreads', function(data) {          
  alert(data.overskrift);
  });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>but it dont show anything :S</p>
  
  <p>my model file</p>
  
  <pre><code>function forumList()
  {
      $this-&gt;db-&gt;select('overskrift', 'indhold', 'brugernavn', 'dato');
      $this-&gt;db-&gt;order_by('id', 'desc');
      $forum_list = $this-&gt;db-&gt;get('forum_traad');
  
      if($forum_list-&gt;num_rows() &gt; 0)
      {
          return $forum_list-&gt;result();
      } else {
          return false;
      }
  }
  </code></pre>
  
  <p>my controller</p>
  
  <pre><code>function forumThreads() {
  
      $this-&gt;load-&gt;model('ajax_model');
      $data['forum_list'] = $this-&gt;ajax_model-&gt;forumList();
  
      if ($data['forum_list'] === true)
      {
          echo json_encode($data['forum_list']);
          $this-&gt;load-&gt;view('includes/footer', $data); 
      } else {
          return  false;
      }
  
  
  }
  </code></pre>