I have a code that throws an ID in the HTML for a link:
<a href="javascript:confirmacao(<?php echo $row['idfoto'] ?>)"> <i class="fas fa-trash"></i></a>
In JavaScript I already have the code that calls the file delete.php
, which takes the ID.
function confirmacao(id) {
var resposta = confirm("Tem certeza que deseja remover essa informação?");
if (resposta == true) {
$.ajax({
url: '/delete.php?delete_id=' + id,
type: 'GET',
dataType: 'json'
}).done(function (data) {
$.get("/read.php", {}, function (data, status) {
$('.read_content').html(data);
});
});
}
}
I made a modification and created a function inside the ready
of jQuery as above, which is giving this error when I click on the link.
VM499: 1 Uncaught ReferenceError: Confirmation is not defined at: 1: 1 (anonymous) @ VM499: 1
You're talking about the function not defined, does it have something to do with jQuery?