title: jQuery load Wordpress pages via ajax
body: <p>I'm trying to setup a Wordpress theme which loads pages (not posts) with AJAX.  I was following <a href="http://www.emanueleferonato.com/2010/04/01/loading-wordpress-posts-with-ajax-and-jquery/" rel="noreferrer">this guide</a> but haven't been able to get the correct pages to load.</p>
  
  <p>The links to the posts are being generated with the post slug</p>
  
  <pre><code>http://local.example.com/slug/
  </code></pre>
  
  <p>So I adjusted </p>
  
  <pre><code> jQuery(document).ready(function($){
          $.ajaxSetup({cache:false});
          $("a.bar").click(function(e){
              $('page-loader').show();
              var that = $(this).parent();
  
              $('.column').not($(this).parent()).animate({width: 'toggle',opacity:'0.75'}, 700, function() {
  
              });
  
              var post_id = $(this).attr("href");
              $("#page-container").load("http://&lt;?php echo $_SERVER[HTTP_HOST]; ?&gt;" + post_id,{id:post_id});
  
              return false;
          });
      });
  </code></pre>
  
  <p>The URL is correct but it doesn't load anything..</p>
  
  <hr>
  
  <pre><code>&lt;?php
  /*
  Template Name: Triqui Ajax Post
  */
  ?&gt;
  &lt;?php
  $post = get_post($_POST['id']);
  ?&gt;
  &lt;?php if ($post) : ?&gt;
      &lt;?php setup_postdata($post); ?&gt;
      &lt;div &lt;?php post_class() ?&gt; id="post-&lt;?php the_ID(); ?&gt;"&gt;
          &lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;
          &lt;small&gt;&lt;?php the_time('F jS, Y') ?&gt; &lt;!-- by &lt;?php the_author() ?&gt; --&gt;&lt;/small&gt;
  
          &lt;div class="entry"&gt;
              &lt;?php the_content('Read the rest of this entry &amp;raquo;'); ?&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;
  &lt;?php endif; ?&gt;
  </code></pre>