簡體   English   中英

數據模式對話框不顯示

[英]Data modal dialog does not show up

我創建了一個按鈕,單擊該按鈕即可查看車輛詳細信息。 但是,我的數據模式對話框沒有顯示。 這是我的代碼。

<table class="table table-striped">  
                                          <tr>  
                                               <th width="40%">Plate Number</th>
                                               <th width="30%">Type</th>  
                                               <th width="30%">View</th>  
                                          </tr>  
                                          <?php  
                                          while($row = mysqli_fetch_array($result))  
                                          {  
                                          ?>  
                                          <tr>  
                                               <td><?php echo $row["plateNo_vehicle"]; ?></td> 
                                               <td><?php echo $row["vehicle_Type"];?></td> 
                                               <td><input type="button" name="view" value="view" id="<?php echo $row["id_vehicle"]; ?>" class="btn btn-info btn-xs view_data" /></td>  
                                          </tr>  
                                          <?php  
                                          }  
                                          ?>  
                                     </table>  

這是模態類和腳本。 該腳本應該包含應該查看所有車輛詳細信息的ajax,但是我更改它只是為了彈出數據模態對話框,原因僅在於根本不會顯示數據模態。

<div id="dataModal" class="modal fade">  
  <div class="modal-dialog">  
       <div class="modal-content">  
            <div class="modal-header">  
                 <button type="button" class="close" data-dismiss="modal">&times;</button>  
                 <h4 class="modal-title">Vehicles Details</h4>  
            </div>  
            <div class="modal-body" id="vehicle_detail">  
            </div>  
            <div class="modal-footer">  
                 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>  
            </div>  
       </div>  
  </div>  

腳本

<script>
$(document).ready(function(){
    $('.view_data').click(function(){
        $('#dataModal').modal("show");
    });
});

如果您使用的是Bootstrap,則只需添加:

data-toggle="modal" data-target="#dataModal"

按鈕中的屬性

好像您要加載jQuery兩次。

第一個實例: <script src="../vendor/jquery/jquery.min.js"></script>

二審: <script src="ajax.googleapis.com/ajax/libs/jquery/2.2.0/…

這可能會引起沖突。 堅持使用最新版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM