codeigniterのページ付けデータテーブルの10レコード後に、ブートストラップモーダルがポップアップしませんでした

jaydev vara

データテーブルのページ付けを10回記録した後、ブートストラップモーダルがポップアップしませんでした。理由がわからないので助けてください。私はこれを解決しようと多くのことを試みましたが、私はこれを理解することができません。jqueryについてはわかりませんので、ansを教えてください。これが私のphpコードです:

<table id="example1" class="table table-bordered table-striped">
<thead>
    <tr>
        <th>Sr No</th>
        <th>Title</th>
        <th>Description</th>
        <th>Status</th>
        <th>Deadline Date</th>
        <th>Add</th>
        <th>Show</th>
    </tr>
</thead>
<tbody>
 <?php
 $str = 1;
 foreach ($getplan as $key => $get) {
    ?>
    <tr>
        <td><?php echo $str; ?></td>
        <td><?php echo $get['title']; ?></td>
        <td><?php echo $get['description'] ?></td>
        <td><?php echo $get['color'] ?></td>
        <td><?php echo $get['end_date'];?></td>
        <td>
            <?php echo $get['members'] ?><br/>
            <a href="<?php echo base_url() . "welcome/get_member_id/" . $get['id'] ?>"<i class="fa fa-plus" aria-hidden="true"></i>Add Member</a>
        </td>

        <td>
            <input type="button" name="view" value="Show" id="<?php echo $get['id'] ?>" class="btn btn-info btn-xs view_data" />
        </td>

    </tr>
    <?php
    $str++;
}
?>

これが私のモーダルです:

<div id="dataModal" class="modal fade">  
<div class="modal-dialog modal-lg">  
    <div class="modal-content">  
        <div class="modal-header">  
            <button type="button" class="close" data-dismiss="modal">&times;</button>  
            <h4 class="modal-title">Employee Tast Details</h4>  
        </div>  
        <div class="modal-body" id="employee_detail"> 
        </div>  
        <div class="modal-footer">  
            <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>  
        </div>  
    </div>  
</div>  

ここに私のスクリプト:

<script type="text/javascript">
$(document).ready(function(){   
    $('.view_data').click(function(){  
        var employee_id = $(this).attr("id");
        $.ajax({  
            url:"<?php echo base_url('welcome/show'); ?>",  
            method:"post",  
            data:{employee_id:employee_id},  
            success:function(data)
            {  
                $('#employee_detail').html(data);  
                $('#dataModal').modal("show");  
            }  
        });  
    });  
});  

Sorav Garg

jQueryコードを変更してください。次のようなクリックイベントを使用してください-

$('body').on('click','.view_data',function(){

の代わりに -

$('.view_data').click(function(){

現在、クリックイベントは機能していません。

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

Related 関連記事

ホットタグ

アーカイブ