关闭警报按钮后,如何导航到新的HTML页面

时间:2020-04-23 16:58:57

标签: javascript html

我有一个Web应用程序,正在使用Flask,Python和JS,Jinja2。

我需要的

我从后端获取数据,并且如果后端返回结果中有任何错误,那么我将显示警报消息。关闭警报消息后,我应该转到新的html页面,提示不允许执行此操作。

我做什么


if (result.error == "error") {
                            alert("You cant perform this operation again")
                            location.href = "expiry.html"
                        }

此处“ expiry.html”是html文件,不允许显示此操作。


html>

<head>
    <title>
        Link expiration
    </title>
</head>

<body>
    <p>The  operation you have performed is not allowed. </p>
</body>

</html>

正在发生的事情 当我尝试此操作时,出现404错误。

我尝试过的是 window.location.href =“ / expiry.html”

但这也不起作用。

因此,当我关闭警报框时,如果应该转到expiry.html页面并显示消息

0 个答案:

没有答案