So i want to post 2 values from my html code to the php code 1 value is - up or down 2 value is - post id
I have posts and when users clicks on up it posts up, post_id
<script>
function vote(val)
{
var params = {"vote":val.id};
$.ajax({
data: params,
url: 'vote.php',
type: 'post',
success: function (response) {
}
});
}
</script>
<a id='up' class='fas fa-angle-up' onclick='vote(this);'></a>
vote.php
if(!empty($_POST['vote'])) {
if ($_POST['vote']=='up')
{
// Also some how should get second value i think it's done with $_POST['id']
}
if ($_POST['vote']=='down')
{
// Also some how should get second value i think it's done with $_POST['id']
}
}
Actually i don't really know where i should add post_id since id in a tag is already taken