doudong4532 2018-08-02 05:04
浏览 55

点击域名模式应该像弹出一样打开

in notification list I used sql query to display domain name but i want to each domain name when I click on that will open popup with there details.

this is header file---

 <!-- notification start -->
        <li class="dropdown">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown">Notification <b class="caret"></b></a>
                      <ul class="dropdown-menu short-dropdown-menu">

                         <li class=""> <a href="<?=Url::to(['domains/index']);?>">
                    <?php
                    $domains=Domains::find()
                      ->Where('expirydate BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 1 MONTH)')
                      ->andWhere(['or',
                                ['status'=> 'Active'],
                                ['status'=> 'Pending Transfer']
                            ])
                      ->orderBy(['expirydate' => SORT_ASC])
                      ->all();                                                                                    
              $domainList=ArrayHelper::map($domains,'id','domainname');
              foreach($domainList as $key => $value)
                     {
                        print '<br>'. $value .'<br>';
                     }
                    ?>       
                     </a></li>                                           
                      </ul>
                    </li>
        <!-- notification ends -->

now result is open like ---

enter image description here

when click on that domain name it have to display popup with details like below image-----

enter image description here

UPDATE QUESTION:

<li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Notification <b class="caret"></b></a>
        <ul class="dropdown-menu short-dropdown-menu">
            <li class="">
                <a href="#modal-domaindetails" data-toggle="modal" onclick="getDomainDetails('2696')">

                <?php
                    $domains=Domains::find()
                            ->Where('expirydate BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 1 MONTH)')
                            ->andWhere([
                                          'or',
                                          ['status'=> 'Active'],
                                          ['status'=> 'Pending Transfer']
                                      ])
                            ->orderBy(['expirydate' => SORT_ASC])
                            ->all();                        


                    $domainList=ArrayHelper::map($domains,'did','domainname');
                        foreach($domainList as $key => $value) {
                            print '<br>'. $value .'<br>';
                        }
                ?>
                </a>  
            </li>                                           
        </ul>
    </a>
</li>

see this now i am passing id 2696 but i want to take id as per domain name how is it possible

  • 写回答

2条回答 默认 最新

  • dongyi1982 2018-08-02 06:50
    关注

    In my opinion, I have some view of it.

    1. If you want to open a new popup modal, you have to create a modal popup, like that https://getbootstrap.com/docs/4.1/components/modal/

    2. You put URL redirect to domain name as ">, it will be redirected to this link. You can not get any pop up here, except you want to open a new tab or new window in chrome. (with open new tab or new window you can search it on google)

    3. In "li" and "a" tag

      <li class=""> <a href="your_url"> ... your code php foreach($domainList as $key => $value) { print '<br>'. $value .'<br>'; } </a> </li>

    you put an iterator, it will be rending a list but they have the same redirect to a URL

    UPDATE MY ANSWER

    Maybe I hope it will help you.

    HTML:

    <li class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Notification <b class="caret"></b></a>
            <ul class="dropdown-menu short-dropdown-menu">
                <li class="">
    
                    <?php
                        $domains=Domains::find()
                                ->Where('expirydate BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 1 MONTH)')
                                ->andWhere([
                                              'or',
                                              ['status'=> 'Active'],
                                              ['status'=> 'Pending Transfer']
                                          ])
                                ->orderBy(['expirydate' => SORT_ASC])
                                ->all();                        
    
    
                        $domainList=ArrayHelper::map($domains,'did','domainname');
                            foreach($domainList as $key => $value) {
                    ?>
                    <a href="javascript:;" onclick="getDomainDetails('<?= $key ?>')"><?= $value ?></a>
                    <?php
                            }
                    ?>
    
                </li>                                           
            </ul>
        </a>
    </li>
    

    Added Modal popup

    <!-- Modal -->
    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
    
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    </div>
            </div>
        </div>
    </div>
    

    JAVASCRIPT

    <script>
    
        function getDomainDetails(domain_id) {
            $.ajax({
                url: 'domains/index',
                method: 'GET', // or 'POST'
                data: { domain_id : domain_id }
            })
            .done(function(response) {
                $('#exampleModal').find('.modal-body').html(response); // append reponse html from server
                $('#exampleModal').modal('show'); // show modal
            });
        }
    
    
    </script>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序