WordPress custom post type post item data – show/fetch only on click with Javascript dynamically?

I think you should be able to do this:

HTML:

<a class="view_post_details" href="#" post_id="<?php the_ID(); ?>">View Post Details</a>

JS:

$(".view_post_detals").click(function () {

   var id_post = $(this).attr('post_id');

    $.ajax({
       type: 'POST',
       url: '<?php echo admin_url('admin-ajax.php'); ?>',
       data: {
          'post_id': id_post,
          'action': 'f711_get_post_content' //this is the name of the AJAX method called in WordPress
       }, success: function (result) {

           alert(result);
       },
       error: function () {
           alert("error");
       }
   });
});