title: Display data in modal from query
body: <p>I have this table with data and a link to display detail into modal</p>
  
  <pre><code>&lt;td&gt;&lt;a data-toggle="modal" class="btn" href="#modal_detail" id="&lt;?php echo $rows['id']; ?&gt;"&gt;Detail&lt;/a&gt;&lt;/td&gt;
  </code></pre>
  
  <p>and this is the modal</p>
  
  <pre><code>&lt;div id="modal_detail" class="modal hide fade"&gt;
      &lt;div class="modal-header"&gt;
        &lt;button class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
        &lt;h3&gt;Detail Product&lt;/h3&gt;
      &lt;/div&gt;
      &lt;div class="modal-body"&gt;            
          &lt;div id="modalContent" style="display:none;"&gt;
          Here i want to display data from query about the detail of a product (name, price etc)      
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="modal-footer"&gt;
        &lt;a href="#" class="btn btn-info" data-dismiss="modal" &gt;Close&lt;/a&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and this is the php file</p>
  
  <pre><code>if(isset($_GET['detail'])) {
      include_once('../libs/class.database.php');
      $k = new Database();
      $link=$k-&gt;connect(); 
      $query = $link-&gt;query("SELECT name,price FROM products ORDER BY date_created ASC");
      $result=$query-&gt;fetchAll();
  }
  </code></pre>
  
  <p>for the javascript is like below</p>
  
  <pre><code>$("a[data-toggle=modal]").click(function() {
      var id_beli = $(this).attr('id');
  
      $.ajax({
          cache: false,
          type: 'GET',
          url: 'controller/modalPembelian.php',
          data: 'detail=' + id_beli,
          success: function(data) {
              $('#modal_detail').show();
              $('#modalContent').show().html(data); //this part to pass the var
          }
      });
  });
  </code></pre>
  
  <p>My Question is how to display the data from query in the php file (product detail) int o the modal window. The modal just fine, it can show and hide, but the data arent there.</p>
  
  <p>I have tried many ways and search for tutorials but it still the same.</p>
  
  <p>Can anyone show me some example how to display the data using ajax into twitter bootstrap modal.</p>