Files
chookchat/client/script.js
2026-07-20 20:11:06 +10:00

19 lines
584 B
JavaScript

async function like(id) {
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);
const result = await fetch('/like', {
method: 'POST',
body: formData
});
if (result.status < 200 || result.status >= 400) {
alert("your post didnt get the like because the server thought your opinion was invalid");
}
}