2014-03-26 53 views
0

在Bootstrap3中再次突破我的頭。我一直在使用帶有模式窗口的BT3。下面的代碼工作並第一次獲取遠程模式窗口,並不會在我第二次點擊。Bootstrap3使用PHP的遠程內容

我已經檢查了以下論壇:

http://www.whiletrue.it/how-to-update-the-content-of-a-modal-in-twitter-bootstrap/

How to show a URL in Bootstrap Modal dialog: On button click

Bootstrap 3 with remote Modal

http://getbootstrap.com/javascript/#modals

從文檔:

如果提供了遠程URL,內容將通過jQuery的加載方法加載一次,並注入到.modal-content div中。如果您使用的是data-api,則可以使用href屬性來指定遠程源。這方面的一個例子如下:

<a data-toggle="modal" href="remote.html" data-target="#modal">Click me</a> 

的index.php

  <a data-toggle="modal" data-target="#myModal" class="btn btn-primary" data-keyboard="false" data-backdrop="false" href="emp_details.php?id=1">Employee 1</a> <a data-toggle="modal" data-target="#myModal" class="btn btn-primary" data-keyboard="false" data-backdrop="false" href="emp_details.php?id=2">Employee 2</a> <a data-toggle="modal" data-target="#myModal" class="btn btn-primary" data-keyboard="false" data-backdrop="false" href="emp_details.php?id=3">Employee 3</a> 
     <div class="modal fade" id="myModal"> 
      <div class="modal-dialog"> 
      <div class="modal-content"> 
       <div class="modal-header"> 
       <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button> 
       <h4 class="modal-title">Test</h4> 
       </div> 
       <div class="modal-body">Test</div> 
       <div class="modal-footer"> 
       <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> 
       </div> 
      </div> 
      </div> 
     </div> 

emp_details.php

 <div class="modal-header"> 
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button> 
      <h3 id="myModalLabel">Modal header</h3> 
     </div> 
     <div class="modal-body"> 
      <?php print_r($_GET); ?> 
     </div> 
     <div class="modal-footer"> 
      <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> 
     </div> 

所以現在我的問題是:

  1. 是有一種方法可以獲得每次點擊href時動態模式框?
  2. 反正有沒有任何問題動態加載遠程內容?

回答