-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubscribers.php
62 lines (60 loc) · 2.2 KB
/
subscribers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head>
<title>Searchable Table with DataTables</title>
<link rel="stylesheet" href="https://cdn.datatables.net/2.0.5/css/dataTables.dataTables.css" />
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.datatables.net/2.0.5/js/dataTables.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>
<body>
<table id="example" class="table table-striped" style="width:100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th></th>
</tr>
</tfoot>
</table>
<script>
$(document).ready(function() {
// Initialize DataTable
var table = $('#example').DataTable({
"ajax": {
"url": "subscribersLogic.php",
"dataSrc": ''
},
"columns": [
{ data: "siteName" },
{ data: "networkName" },
{ data: "prefixName" },
{ data: null, defaultContent: '<button id="deleteBtn">Delete!</button>' },
{ data: null, defaultContent: '<button>Click!</button>' }
]
});
// Event handler for button click
$('#example').on('click', 'button#deleteBtn', function (e) {
var data = table.row($(this).parents('tr')).data();
var siteName = data["siteName"]
$.post("deleteRowFromDb.php", {siteName},
function(data)
{
alert(data);
table.ajax.reload();
}
);
});
});
</script>
</body>
</html>