Get content from WordPress posts in Boostrap modal window – Javascript side?

Since I’m guessing you’re not rendering that Javascript file with PHP, you’ll need to send the ID of the post to that anonymous function using something other than PHP. You could use a data attribute in your #clickme <a> like data-id="<?php the_ID(); ?>" and then change your on click to:

  $(document).ready(function(){  
    $("#clickme").on
      ("click", function(){ $("#myModal-" + $(this).attr('data-id')).modal();});
  });

Or something similar to that.