我正在调用提交按钮并为每次点击添加选中的值。我想添加一个倒计时并说:
每 60 秒只计算一次用户点击。否则显示警报。
这是我的代码:
form.addEventListener('submit', (e) => {
const choice = document.querySelector('input[name=os]:checked').value;
const data = {os:choice}
fetch('localhost:3000/poll', {
method: 'post',
body: JSON.stringify(data),
headers: new Headers({
'Content-Type': 'application/json'
})
})
.then(res => res.json())
.then(data => console.log(data))
// alert("Danke für die Abstimmung")
.catch(err => console.log(err));
e.preventDefault();
});
暮色呼如
相关分类