I'm having problems getting a button in javascript to perform an update without giving refresh on the page, at the moment it is not entering the database and is doing refresh hehehe
in index.php
<form>
<button data-id='$futid' class='botao-olho' style='background-color: red;color:#fff'><i class="far fa-thumbs-up"></i>Sim</button>
</form>
<script type="text/javascript">
//pega-se o botão desejado e arzena na variável
$(".botao-olho").on("click", function(){
var $this = $(this);
$.ajax({
url: "update_intencao.php",
data: {id: $this.data("id")},
});
});
</script>
Update.php
<?php
include("conexao.php");
$id = $_POST['id']
$sql3 = "UPDATE fifa19futdados set intencoes = intencoes + 1 where Futbin_ID = $id";
mysqli_query($conexao,$sql3);
?>
If you do not ask for much, I would also like you to depose the action, he would disappear the button and a message appeared, without refresh.
Thank you!