第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

爪哇腳本是否有可能具有帶有ID的 hrefs?

爪哇腳本是否有可能具有帶有ID的 hrefs?

PHP
MMTTMM 2022-09-25 20:38:01
是否可以添加一個包含 ID 的 href 以在運行確認函數(shù)中?我的目標是在我單擊“接受”后顯示一個彈出窗口,并且接受按鈕從 isset 執(zhí)行查詢。這是我接受的代碼。$displaybody .= "<tr><td>" . $rows['lname'] . ", " . $rows['fname'] . "</td> <td>" . $rows['subject'] . "</td> <td>" . $rows['days'] . " " . $rows['rstime'] . " - " . $rows['retime'] . " </td>   <td>" . $rows['note'] . "</td>  <td><a class='runConfirm' data-id='" . $rows['rid'] . "'>Accept</a>                <a href='home.php?decline=" . $rows['rid'] . "'>Decline</a></td></tr>"這是我的彈出窗口功能。(已更新)<script type='text/javascript'>         $(function(){        $('.runConfirm').click(function(event){          // get the id you want to act on          var theId = $(this).data('rid');          // ask user for confirmation          alertify.confirm('Are you sure to accept this request?',            // accepted            function(){              // go to the processing page              window.location('/accept.php?rid=' + theId);            },            // declined            function(){              alertify.error('You clicked CANCEL');          }).set('closable', false);        });        });  </script>接受.php包含接受預訂的流程。    <?php    include("server.php");    session_start();    if(isset($_GET['accept']))    {      $rid=$_GET['accept'];            $query=$mysqli->query("SELECT qid FROM requests WHERE rid='".$rid."'");                if($query->num_rows>0)                {                        while($rows=$query->fetch_assoc())                        {                            $qid=$rows['qid'];                        }            }     $query1=$mysqli->query("UPDATE qualified SET status='accepted' WHERE    qid='".$qid."' ");     $query=$mysqli->query("UPDATE requests SET action='accepted' WHERE    rid='".$rid."'");     header("Location:home.php");   }   ?>
查看完整描述

1 回答

?
墨色風雨

TA貢獻1853條經(jīng)驗 獲得超6個贊

生成 DOM 時,可以將數(shù)據(jù)屬性添加到“Confirm”鏈接,然后可以從單擊回調(diào)函數(shù)訪問該屬性。runConfirm


假設您要使用的id在中,這將給出:(為了清楚起見,僅顯示更改的部分)$rows['rid']


多姆生成


$displaybody .= "<tr>

  <td>" . $rows['lname'] . ", " . $rows['fname'] . "</td>

  <td>" . $rows['subject'] . "</td>

  <td>" . $rows['days'] . " " . $rows['rstime'] . " - " . $rows['retime'] . "</td>

  <td>" . $rows['note'] . "</td>

  <td>

    <a class='runConfirm' data-id='" . $rows['rid'] . "'>Accept</a>                

    <a href='home.php?decline=" . $rows['rid'] . "'>Decline</a>

  </td>

</tr>"

彈出窗口處理(已更新)


$('.runConfirm').click(function(event){

  // get the id you want to act on

  var theId = $(this).data('id');


  // ask user for confirmation

  alertify.confirm('Are you sure to accept this request?',


    // accepted

    function(){


      // go to the processing page

      window.location = '/accept.php?rid=' + theId;

    },


    // declined

    function(){

      alertify.error('You clicked CANCEL');

  }).set('closable', false);


});

你的第三個片段將進入.accept.php

您的代碼將:

  1. 使用行 ID 作為數(shù)據(jù)屬性呈現(xiàn)表

  2. 單擊“接受”時,提示用戶進行確認,并將其發(fā)送到“接受.php”頁面。

  3. 在服務器上運行后處理代碼,最終將用戶重定向到“home.php”

您可以在文檔中找到有關jQuery數(shù)據(jù)的更多信息:https://api.jquery.com/data/


查看完整回答
反對 回復 2022-09-25
  • 1 回答
  • 0 關注
  • 80 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號