用例(Django 项目):
我想在我的登录页面上登录->因此我在 html (login.html) 中使用此表单:
<form class="loginform" action="" method="POST">
{% csrf_token %}
<div class="loginform">
{{form.as_p}}
</div>
<br>
<input type="submit" class="btn btn-success loginbtn" value="Login">
</form>
如果登录成功,我将使用 DJANGO 重定向到此 URL (localhost/welcome/)-> welcome.html:
LOGIN_REDIRECT_URL = "welcome"
我可以使用 alertify 发送 javascript 通知,但仅在使用简单的操作(例如单击它或鼠标悬停)时:
function notification(text) {
console.log(text)
alertify.success(text);
}
我在 html 表单标记中使用 onsubmit="javascript:notification("")" 进行了尝试,但这只会在 URL 重定向之前显示。
所以我的问题是:
如何在 URL 重定向之后激活 / 发送推送通知,并且在成功 POST / 登录的情况下?
我真的很感谢你的帮助!十分感谢!!
三国纷争
相关分类