我试图在将记录插入数据库后显示一条警报消息,并且正常的 js 警报工作正常,其代码是
echo '<script>';
echo 'alert(" Your request has been successfully filled and your Letter No is\n'.$Dep.'/'.$fy.'/ "+"'.$id.'.\nKindly submit the original copy of this letter to CRDS.")';
echo '</script>';
echo "<script>window.location.href='dashboard.php'</script>";
exit;
但是,当我使用 sweet Alert 函数而不是普通的 js 函数时,它不会显示任何消息。我的代码出了什么问题> 我在代码中包含了 sweet Alert 库。我的代码是
echo '<script>';
echo 'swal(" Your request has been successfully filled and your Letter No is\n'.$Dep.'/'.$fy.'/ "+"'.$id.'.\nKindly submit the original copy of this letter to CRDS.")';
echo '</script>';
echo "<script>window.location.href='dashboard.php'</script>";
exit;
在你的标题中,
Add,
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
Then,
echo '
<script type="text/javascript">
$(document).ready(function(){
swal({
title: "Successfully save!",
html: "Your request has been successfully filled...",
timer: 2000,
timerProgressBar: true,
}).then(function() {
window.location = "( Your link here. )";
});
});
</script>
';
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)