Hello, good afternoon!
I'm having a problem that I do not know how to solve. I do not know how to program in JQuery or Ajax, but I intend to start learning. How can I do to make the following code in PHP work in Ajax or JS? Which of the two options is best for this "Like" action?
<li>
<form action="like-post.php" method="post">
<button name="id" value="<?= $post["id"] ?>" class="like-post">Like</button>
</form>
</li>
<li class="likes">
<?php
echo $post["likes"];
?>
</li>
Like-post page code:
include("header.php");
include("conecta.php");
include("functions.php");
$id = $_POST['id'];
like($conecta, $id);
header("Location: index.php");
die();
What I want to do is that this button as soon as it clicks it adds another tanned to the post. Thank you in advance!