Load post content via Ajax & Jquery

<?php 
// https://stanhub.com/load-wordpress-post-content-with-ajax-and-jquery/
if (have_posts()) : while (have_posts()) : the_post(); ?>
<a class="post-link" rel="<?php the_ID(); ?>" href="<?php the_permalink(); ?>">
 <div id="<?php $category = get_the_category(); echo $category[0]->cat_name; ?>"> 
   <?php the_post_thumbnail(); ?>
   <span class="title"><?php the_title(); ?></span>    
   <span class="excerpt"><?php the_excerpt(); ?></span>
</div>
</a>
<?php endwhile; endif; ?>
<div id="single-post-container"></div></code>
<?php
 // single.php
    $post = get_post($_POST['id']);
?>
    <div id="single-post post-<?php the_ID(); ?>">
    <?php while (have_posts()) : the_post(); ?>
                <?php the_title();?>
                <?php the_content();?>
    <?php endwhile;?> 
</div>
<script>
   $(document).ready(function(){
 
        $.ajaxSetup({cache:false});
        $(".post-link").click(function(){
            var post_link = $(this).attr("href");
 
            $("#single-post-container").html("content loading");
            $("#single-post-container").load(post_link);
        return false;
        });
 
    });
</script>