Привет, просто я хочу вызвать мой файл My delete.php с помощью URL Ajax, но я не вызываю страницу php. я перенаправил к функции успеха, не достигнув php page.check мой код.
==> View.php
$(document).on("click", "#delBtn", function(){
var id = $(this).closest('tr').attr('id');
$.ajax({
type: 'POST',
url : 'delete.php',
data:id,
success: function () {
alert("Deleted Successfully");
},
error: function(xhr, textStatus, error){
alert(xhr.statusText);
alert(textStatus);
alert(error);
}
});
});
==> delete.php
<?php
include_once('database/db.php');
if(isset($_POST['id'])){
$id = $_POST['id'];
var_dump($id);
exit();
$getUsers = $connect->prepare("DELETE FROM registration WHERE id =
'".$id."' ");
$getUsers->execute();
}
?>