title: infinite scroll in codeigniter using jquery
body: <p>Hello guys i have a simple problem i think:</p>
  
  <p>I've created a blog in code igniter and this is how my code looks:</p>
  
  <p>this is my home_page controller:</p>
  
  <pre><code>public function index()
      {
          $data['posts'] = $this-&gt;Model_cats-&gt;getLivePosts(7);
          $data['cats'] = $this-&gt;Model_cats-&gt;getTopCategories(); 
          $data['title'] = 'Welcome';
          $data['main'] = 'public_home';
          $data['main2'] = 'public_home_loadpost';
          $this-&gt;load-&gt;vars($data);
          $this-&gt;load-&gt;view('template', $data);
      }
  </code></pre>
  
  <p>and i use this jquery for loading:</p>
  
  <pre><code>$(window).scroll(function())
  {
      if( $(window).scrollTop() == $(document).height() - $(window).height() ){
          $('div#loadMoreComments').show();
  
          $.ajax({
              url: "WHAT PAGE PUTHERE.php?lastComment=" + $(".postedComment:last").attr("id"),
              success: function(html){
                  if(html)
                  {
                      $("#postedComments").append(html);
                      $('div#loadMoreComments').hide();
  
                  }
                  else
                  {
                      $('div#loadMoreComments').replaceWith("Finished Loading the comments");
                  }
              }
          });
      }
  </code></pre>
  
  <p>i really don 't know what page i can put in my url in the jquery file... the page that will get more posts for me. help please</p>
  
  <p>my view looks like this</p>
  
  <pre><code>&lt;?php
  
      if ( count($posts) )
      {
          foreach ($posts as $key =&gt; $list)
          {
              echo "&lt;div class='postedComment'&gt;";
              echo '&lt;h2&gt;'.$list['title'].'&lt;/h2&gt;';
              echo auto_typography( word_limiter($list['body'], 200) );
              echo anchor('welcome/post/'.$list['id'],'read more &gt;&gt;');
              echo "&lt;/div&gt;";
          }
  
          echo '&lt;br/&gt;&lt;br/&gt;';
      }
  
  ?&gt;
  
  &lt;div id='loadMoreComments' style="display:none;"&gt;hello&lt;/div&gt;
  </code></pre>