<span id="<?php echo $todo['id']?>" onclick="removeToDo(this)" class="remove-to-do">x</span>
<script>
function removeToDo(e) {
var response = await (await fetch('app/remove.php', {
method: 'POST',
headers: { 'Content-Type' : 'application/x-www-form-urlencoded; charset=UTF-8' },
body: new URLSearchParams({ id: e.getAttribute('id') }).toString()
})).text();
console.log('Ответ сервера', response);
}
</script>