php - 使用 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>';
}
解决方案
使用 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>
推荐阅读
- java - 项目 'org.springframework.boot:spring-boot-starter-parent:2.4.0' 未找到
- python-3.x - 将字符串转换为数字(浮点或整数,取决于输入的变量)
- javascript - 关于属性的打字稿警告不存在于其中一种响应类型中
- android - 谷歌 Playstore 是否会对销售杂货等非数字商品的应用程序收费
- javascript - 财产不承认
- c - 如何比较 POSIX ACL?
- java - 在 Tomcat 上部署 ncWMS2 WAR
- ios - iOS Share Extension,获取共享Item的标题
- python - 如何访问和重新配置它定义的功能之外的任何小部件?
- javascript - 如何启用双鼠标指针/双鼠标指针