Iam mit Datatable Dies gilt mein Code:eine Zeile in PHP holen und Datentabelle
var table = $('#open').DataTable({ });
Das ist mein HTML-Tabelle Code:
<table id="open">
<thead>
<tr>
<th rowspan="2"> S.No </th>
<th rowspan="2"> Patient Name </th>
<th colspan="2"> Booking </th>
<th rowspan="2"> Insurance Company</th>
<th rowspan="2">Appointment Status</th>
<th rowspan="2">Edit</th>
</tr>
<tr>
<th> Date </th>
<th> Time </th>
</tr>
</thead>
<tbody id="booking">
</tbody>
</table>
Das ist mein Ajax-Code:
var date = $("#date").val();
$.ajax({
type: 'POST',
url: 'booked1.php',
data: {
date: date
},
cache: false,
dataType: "html",
success: function (response) {
alert(response);
$("#booking").html(response);
$("#loadarModal").modal('hide');
}
});
Dies ist mein booked1.php Code:
if (isset($_POST['date'])) {
$date = $_POST['date'];
$query = mysqli_query($conn, "select id as id, concat(fname,' ',lname) as name, date as date, bookingtoken as bookingtoken, inusrance as insurance,
appointment_status as appointment_status from at_booking where date='$date'
");
while ($rows = mysqli_fetch_assoc($query)) {
$name = $rows['name'];
$id = $rows['id'];
$date = $rows['date'];
$bookingtoken = $rows['bookingtoken'];
$insurance = $rows['insurance'];
$appointment = $rows['appointment_status'];
echo '<tr>';
echo "<td>$id</td>";
echo "<td>$name</td>";
echo "<td>$date</td>";
echo "<td>$bookingtoken</td>";
echo "<td>$insurance</td>";
echo "<td>$appointment</td>";
echo '</tr>';
}
}
Ich bin erfolgreich holen Zeilen durch PHP und Anhängen Antwort an tbody aber Datentabelle funktioniert nicht richtig wie Suche funktioniert nicht und keine der Einträge funktioniert nicht Seitennummerierung wird nicht angezeigt ich weiß nicht, wie man das lösen kann mir jemand helfen
Versuchen Sie, Ihre Tabelle mit JSON-Antwortdaten anzuhängen ?????? –
Die Datentabelle ist nicht so konzipiert, dass sie wie Sie geändert werden kann - sie filtert die Filterung/Seitennummerierung usw. Wenn Sie entfernte Daten über ein Datatable abrufen möchten, müssen Sie das 'remote' Setup korrekt verwenden. –
@RoryMcCrossan hat Sie nicht bekommen – karthik