我有一个要编辑的页面表单,使用提交按钮' save'。单击保存后,我希望我的页面自动刷新以显示修改。但我希望它只有在我延迟后不点击保存时才刷新。只需一次,无需每隔x秒刷新一次!
if (isset($_POST['ajout'])) {
$travail = str_replace("'","'", $_POST['travail']);
$req = $fun -> modifier($_POST['name'], $travail);
if ($req) {
echo '
<script type="text/javascript">
setTimeout(function() {
document.getElementById("merci").style.display = "none";
},10000);
</script>
<div id="merci" class="alert alert-success fade in">
<button data-dismiss="alert" class="close close-sm" type="button">
<i class="fa fa-times"></i>
</button>
success
</div>
';
} else {
echo '
<script type="text/javascript">
setTimeout(function() {
document.getElementById("merci").style.display = "none";
},10000);
</script>
<div id="merci" class="alert alert-danger fade in">
<button data-dismiss="alert" class="close close-sm" type="button">
<i class="fa fa-times"></i>
</button>
<strong>erro</strong> try aagain
</div>
';
}
}