I'm trying to perform an Update on my table through javascript so I do not have to leave the screen every time I inactive a field, my table:
ThebuttonIusedinPHPbutwenttoanotherpage:
<tdclass="center">
<?php echo"<a class='btn btn-danger' href='update_produto.php?ID=$id'>Inativar</a>";?>
</td>
My button:
<button id='botao-olho' onclick='myFunction()'>Inativar</button>"
Here is the script that goes to the update
<script type="text/javascript">
var btn_olho = $("#botao-olho");
btn_olho.on("click", function(){
$.ajax({
url: "update_produto.php",
type:"html",
dataType: "GET",
data: {id: <?php echo $id ?>}
}).done(function(retorno){
});
});
here is the update:
$id = $_GET['ID'];
$estado = 'Inativo';
$sql = "UPDATE MASTER_COLETORES SET ESTADO = '$estado' WHERE ID = $id";
$stmt = oci_parse($conexao, $sql);
$result = oci_execute($stmt);
Click the button and nothing happens: T