how i can display data using datatable ? i can't display data
this function show data
function viewData(){
$("#contoh").dataTable({
'bProcessing': true,
'bServerSide': true,
"ajax":{
url :"core/process.php",
type: "post",
success : function(data){
$('tbody').html(data);
}
}
});
}
this query show data using pdo mysql
$stmt = $db->prepare("SELECT * FROM pelanggan");
$stmt->execute();
$no = 1;
while($row = $stmt->fetch()){
?>
<tr>
<td><?php echo $no++;?></td>
<td><?php echo $row['id_pelanggan'];?></td>
<td><?php echo $row['nm_pelanggan'];?></td>
<td><?php echo $row['alamat'];?></td>
<td><?php echo $row['telepon'];?></td>
<td><?php echo $row['email'];?></td>
<td width="160">
<button class="btn btn-warning" data-toggle="modal" data-target="#edit-<?php echo $row['id_pelanggan']; ?>">Edit</button>
<button type="button" class="btn btn-danger" onclick="deleteData(<?php echo $row['id_pelanggan']?>)"> Delete </button>
</td>
</tr>
<?php
}
and this structure table
<div class="table-responsive">
<table class="table table-striped table-bordered" id="contoh">
<thead>
<tr>
<th>No</th>
<th>Kode Pelanggan</th>
<th>Nama Pelanggan</th>
<th>Alamat</th>
<th>Nomor Telepon</th>
<th>Email Pelanggan</th>
<th width="50">Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
how i can fix it?
It looks like you're new here. If you want to get involved, click one of these buttons!