我是python新手,我正在制作一个登录页面,前端是HTML、CSS、JS,后端是python,一切正常,现在我想在用户输入错误密码时显示一个弹出式javascript代码,我的代码已经准备好了,但我不知道如何将javascript连接到python,也不知道如何显示弹出式javascript代码。 现在,当用户输入错误密码时,我返回一条静态消息: 非常感谢您的帮助。:)
My javascript popup code: Source Code from JS
let timerInterval
Swal.fire({
title: 'You entered wrong username or password',
html: 'I will close in <b></b> milliseconds.',
timer: 2000,
timerProgressBar: true,
onBeforeOpen: () => {
Swal.showLoading()
timerInterval = setInterval(() => {
const content = Swal.getContent()
if (content) {
const b = content.querySelector('b')
if (b) {
b.textContent = Swal.getTimerLeft()
}
}
}, 100)
},
onClose: () => {
clearInterval(timerInterval)
}
}).then((result) => {
/* Read more about handling dismissals below */
if (result.dismiss === Swal.DismissReason.timer) {
console.log('I was closed by the timer')
}
})
My Python Code : When login fails
return (login_result)
if login_result == '0':
return('Successful')
elif login_result != '0':
return('invalid credentials')
My HTML Code : for login button
<div>
<button>
Login
</button>
</div>
目前没有回答
相关问题 更多 >
编程相关推荐