首页 > 解决方案 > 使用 javascript 在 php 中删除警报

问题描述

我很困惑如何在这种情况下添加删除警报

else 
    if($g=='hapus')
    {
        // echo '<a href="hapus.php?id=123" onclick="javascript: return confirm('Anda yakin hapus ?')">Hapus</a>'

        mysqli_query($config,"DELETE FROM tb_perangkat where id_perangkat='$_GET[id_perangkat]'");
         echo '<script LANGUAGE="JavaScript">

            alert("Anggota dengan Id '.$_GET[id_perangkat].' Telah Terhapus")
            window.location.href="index.php?page=admin";
            </script>';
    }

标签: php

解决方案


使用 jquery 隐藏你的 div

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("p").click(function(){
    $(this).hide();
  });
});
</script>
</head>
<body>

<p>If you click on me, I will disappear.</p>
<p>Click me away!</p>
<p>Click me too!</p>

</body>
</html>


推荐阅读