我正在使用html和php创建表单,提交表单后,我想用sweetalert显示成功消息,并希望将窗口定位到另一个页面。我尝试了以下代码,但没有用。请告诉我我要去哪里了echo '<script type="text/javascript">';echo 'setTimeout(function () {';echo 'swal("Success!","Your complaint has been successfully registered.\n Your Customer Complaint No. is\n "+"'.$complainno.'","success") .then( function(val) { if (result.value) { window.location = "/cashier.php"; }'; echo '});';echo '}, 200); </script>';
1 回答
慕尼黑8549860
TA贡献1818条经验 获得超11个赞
这是解决方案:
echo '<script>
setTimeout(function() {
swal({
title: "Success!",
text: "Your complaint has been successfully registered.Your Customer Complaint No. is"+$complainno,
type: "success"
}, function() {
window.location.href = "cashier.php"; // window.location also can be used
});
}, 1000);
</script>';
- 1 回答
- 0 关注
- 226 浏览
添加回答
举报
0/150
提交
取消