2016-06-17 33 views
0

下面的腳本的如何使用我已經包含了定位標記

<link rel="stylesheet" href="css/bootstrap.min.css" /> 
<script src="js/jquery-2.0.0.min.js"></script> 
<script src="js/bootstrap.min.js"></script> 
<script src="js/jquery.dataTables.js" type="text/javascript"></script> 

HTML代碼中使用引導模式:

<!-- Modal --> 
    <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 
     <div class="modal-header"> 
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> 
      <h3 id="myModalLabel">Modal header</h3> 
     </div> 
     <div class="modal-body"> 
      <p>One fine body…</p> 
     </div> 
     <div class="modal-footer"> 
      <!--<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> 
      <button class="btn btn-primary">Save changes</button>--> 
     </div> 
    </div> 

我的Ajax調用PHP頁面代碼:

while($row = mysql_fetch_array($run_query)){ 
    $name = $row['first_name']; 
    $name_string = "<a edit_id='name_".trim($name)."' href='#' data-target='#myModal' data-toggle='modal'>{$name}</a>"; 
    //onClick=\"click_today('{$name}');\" 
    $result_array[] = array($row['id'], $name_string, $row['last_name'], $row['job_title'], $row['salary']); 
} 

在我上面的php文件中,我已經將表數據傳遞到了被調用的頁面中,在這裏我用於單擊名稱並顯示模式,這實際上是我需要的,但是m odal不顯示,而不是它會顯示以下輸出 enter image description here

我不知道什麼是我已經包括引導3.3.6 js和css文件

請讓我知道我錯了問題

+0

當我點擊每一個名字從鏈接模式顯示記錄他們的名字 –

+0

在您的標籤中指定數據目標。請看下面的回答 –

回答

0

指定在標籤中的數據目標

$name_string = "<a edit_id='name_".trim($name)."' href='#' data-toggle='modal' data-target='#myModal'>{$name}</a>"; 

如果使用隱藏,然後使用jQuery使用

$('#MymModal').modal('show'); 
+0

讓我們知道它的工作是不是 –

+0

不工作bro –

+0

你能跟蹤跟蹤錯誤,在控制檯 –

0

如果使用錨標記的href使用=「#你的模式ID」

改變你的代碼像

$name_string = "<a edit_id='name_".trim($name)."' href='#myModal' data-toggle='modal'>{$name}</a>"; 
因爲我需要
+0

變更後超過您的建議不起作用.. –

相關問題