title: pass method POST using ajax to php in boostrap modal wordpress
body: <p>Hi guys I am having problem with my ajax passing postID to my modal . var pid gets the id I wanted but when I echo the postID it doesnt get the value from ajax. please help </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function(){
      $('#myModal').on('show.bs.modal', function (e) {
          var pid = $(e.relatedTarget).data('id');
          $.ajax({
             type: 'post',
             url: 'domain/modal.php',
             data: 'post_id=' + pid,
             success: function (r) {
            
             }
          });
      });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;a class="link-to-post" data-toggle="modal" data-target="#myModal" name="modal" data-id="&lt;?php echo get_the_ID(); ?&gt;"&gt;Button&lt;/a&gt;
  
  &lt;?php
  $post_ID = $_POST['post_id'];
  ?&gt;
  
  &lt;div class="modal fade" id="myModal" role="dialog"&gt;
      &lt;div class="modal-dialog"&gt;
        &lt;!-- Modal content--&gt;
        &lt;div class="modal-content"&gt;
          &lt;div class="modal-body"&gt;
           &lt;div class="row"&gt;
            &lt;div class="col-sm-6"&gt;
            &lt;?php echo $post_ID;?&gt; 
            &lt;/div&gt;
            &lt;div class="col-sm-6"&gt;
            &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>