douba3378 2014-05-14 09:34
浏览 23

如何使用bootstrep模态codeigniter显示数据库中的详细数据?

how to display the detailed data from the database based on the ID with modal boostrep twitter, please make it for jquery or ajax code so that the data appears when I click the details into the pop-up modal ?

<tbody id="terakhir" >

                    <?php
                    $iw = $this->uri->segment(3) + 0;
                    foreach ($blogger as $i): $iw++;
                        ?>

                        <tr >
                            <td>  
                                <input type="text" class='nomor' id='<?php echo $iw; ?>'>
                                <input type="text" class='box' >
                                <?php echo $iw; ?></td>
                            <td>
                                <?php echo $i->username; ?>


                            </td>
                            <td class=lastName >
                                <?php
                                $date = strtotime($i->tanggal_register);
                                echo format_date($date, time()) . ' WIB';
                                ?>


                            </td>
                            <td>Member</td>
                            <td>

                                <?php
                                if ($i->akses != "B"):
                                    echo "<span class='label label-success'>Active</span>";
                                else:
                                    echo "<span class='label label-important'>Blokir</span>";
                                endif;
                                ?>

                            </td>

                            <td>

                                <a class="btn btn-danger" href="#">
                                    <i class="fa fa-trash-o "></i> 
                                </a>
                                <a href="#" class="btn tampil<?php echo $iw; ?>">Edit</a>


                            </td>
                        </tr>

                        <?php
                    endforeach;
                    ?>

                </tbody>
  • 写回答

1条回答 默认 最新

  • doudu9652 2015-02-06 18:36
    关注

    Update the username columns as

    <td>
       <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" value="<?php echo $i->username;?>"><?php echo $i->username; ?></button>
    </td>
    

    Now add this javascript to call the modal and load data in ajax

    <script type="text/javascript">
                 $("#terakhir").on('click','button',function(event){
            var username = $(this).val();
            $.ajax({
              type: 'POST',
               url: "yourphpfile.php",                  
              data:"username="+username,
           success:function(data){
              //print your data here in modal html elements
            },
           error:function(error){
            alert(error);
            }});
        });
    </script>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集