Files
chookchat/client/script.js

19 lines
584 B
JavaScript
Raw Normal View History

2026-07-20 20:11:06 +10:00
async function like(id) {
2026-07-20 19:02:04 +10:00
const usernameBox = document.getElementById('username');
const passwordBox = document.getElementById('password');
const formData = new FormData();
formData.append('username', usernameBox.value);
formData.append('password', passwordBox.value);
formData.append('post', id);
2026-07-20 20:11:06 +10:00
const result = await fetch('/like', {
method: 'POST',
body: formData
2026-07-20 19:02:04 +10:00
});
2026-07-20 20:11:06 +10:00
if (result.status < 200 || result.status >= 400) {
alert("your post didnt get the like because the server thought your opinion was invalid");
}
2026-07-20 19:02:04 +10:00
}