title: Get value from page in modal
body: <p>I have table with names, when I am clicking names I need to open modal and put the name I clicked there. How I can do it? Thanks in advance</p>
  
  <p>report.php</p>
  
  <p>button:</p>
  
  <pre><code>&lt;a href='#ReportModal' data-id='1' data-toggle='modal'&gt;Open&lt;/a&gt;&lt;/td&gt;
  </code></pre>
  
  <p>modal:</p>
  
  <pre><code>&lt;div id="ReportModal" class="modal" role="dialog" data-backdrop="static" data-keyboard="false"&gt;
    &lt;div class="modal-dialog"&gt;
  
      &lt;!-- Modal content--&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
          &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
          &lt;h4 class="modal-title"&gt;asd&lt;/h4&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
          //HOW TO PRINT HERE?
        &lt;/div&gt;
        &lt;div class="modal-footer"&gt;
          &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>script</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function() {
      $(document).on("click",".get-data"function(){
         var val = $(this).attr("data-id");    
         $.ajax({
              url: "../dist/scripts/report.userinfo.php",
              type: "POST",
              dataType: "HTML",
              async: false,
              success: function(data) {
                 $('.modal-body').html(data);          
             }
           }); 
  
       });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>report.userinfo.php</p>
  
  <pre><code>&lt;?php
           include($_SERVER['DOCUMENT_ROOT']."/dist/config.php");
           $id = $_POST['id'];
           $query =  $db-&gt;query ("select Name from _reports where ID = '$id' ") or die($db-&gt;error());
           $rows= $query-&gt;fetch_array();
           echo $rows['Name'];
      ?&gt;  
  </code></pre>