redstrate.com/themes/red/assets/js/voting.js

18 lines
546 B
JavaScript
Raw Normal View History

2023-03-28 12:53:02 -04:00
function refresh(slug) {
fetch('https://voting.redstrate.com/votes/view/' + slug)
.then(function(response) {
return response.json();
})
.then(function(data) {
2023-09-04 07:59:34 -04:00
document.getElementById("num-votes").innerHTML = "❤️ " + data["votes"];
2023-03-28 12:53:02 -04:00
});
}
function addVote(slug) {
const request = new Request("https://voting.redstrate.com/votes/submit/" + slug, {
method: "POST"
});
fetch(request)
.then((response) => { refresh(slug) });
}