doz97171 2018-12-05 06:23
浏览 93

弹出js对话框onclick表行并显示php信息

I have a php site that displays table information from MySQL DB. I created a js that will pop-up upon clicking the row table. The problem is it will only function on the first row and nothing for the rest of it. And also I wanted to display the captured information from the row where it was clicked to the popup/dialog box. Thank you!

Here's my Table

<tr id="popup" style="cursor: pointer;">
<td hidden="text"><?php echo odbc_result($result,"OBGyneID"); ?></td>
<td><?php echo odbc_result($result,"Lname"); ?>
    , &nbsp;<?php echo odbc_result($result,"Fname"); ?>
    &nbsp;<?php echo odbc_result($result,"mi"); ?></td>
<td class="hidden-ob-xs"><?php echo odbc_result($result,"Bday");?></td>
<td class="hidden-ob-xs"><?php echo odbc_result($result,"pxAge"); ?></td>
<td class="hidden-ob-xs hidden-ob-sm"><?php echo odbc_result($result,"PhoneNum"); ?></td>    
<td><?php  echo odbc_result($result,"service"); ?></td>  
<td class="hidden-ob-xs hidden-ob-sm"><?php echo odbc_result($result,"obgyneTime"); ?></td>                                                  
</tr>

Here's my JS

        $('#popup').click(function(){
            swal({
                title:  'Are you sure you want to delete this record?',
                text: 'You will not be able to recover this record again!',
                type: 'warning',
                showCancelButton: true,
                buttonsStyling: false,
                confirmButtonClass: 'btn btn-danger',
                confirmButtonText: 'Yes, delete it!',
                cancelButtonClass: 'btn btn-light',
                background: 'rgba(0, 0, 0, 0.96)'
            }).then(function(){
                swal({
                    title: 'Are you sure?',
                    text: 'You will not be able to recover this imaginary file!',
                    type: 'success',
                    buttonsStyling: false,
                    confirmButtonClass: 'btn btn-light',
                    background: 'rgba(0, 0, 0, 0.96)'
                });
            });
        });
  • 写回答

3条回答 默认 最新

  • doubing3662 2018-12-05 06:32
    关注

    add class on TR tag

    <tr class="popup" data-company="Google" style="cursor: pointer;">
    

    change this class to call popup

     $('.popup').click(function(){
    
        var company = $(this).data('company');
    
         /* your code */
    
     });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)