I have a question here.
I have a page for displaying data from my database. I use ajax for handler the data I get.
In my other page I can use this method for displaying data. I am not getting an error massage and the data displaying well. I have check my code and I think there is no error syntax in there.
But why? In this page my code can't get the data and I get this error massage. is this because my library not support for that or have I crashed in my library?
1st. this is the error massage:
and in my html page I use this library.
<script type="text/javascript" src="../jquery/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="../jquery/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="../jquery/jquery-1.12.4.js"></script>
<script type="text/javascript" src="../jquery/jquery.js"></script>
<script type="text/javascript" src="../jquery/jquery.min.js"></script>
<script type="text/javascript" src="../jquery/jquery-ui.js"></script>
and the last this is my code for display the data.
The code for get the data and display the data into the table.
$(document).on('click','#display_data',function(e) {
var data = $("#report_all").serialize();
$('#all_report tbody').empty();
$.ajax({
data: data,
type: "Post",
url: "../php/report/report_all_KA.php",
success: function(data){
var list = JSON.parse(data);
var th = "";
th += "<th>" +'Tanggal'+"</th>";
th += "<th>" +'Type Kadar Air'+"</th>";
th += "<th>" +'Kode Material'+"</th>";
th += "<th>" +'Nama Material'+"</th>";
th += "<th>" +'Storage Location'+"</th>";
th += "<th>" +'Kadar Air'+"</th>";
th += "<th>" +'Nama PPIC'+"</th>";
th += "</th>";
$("#all_report thead").append(th);
for(var i = 0; i < list.length; i++){
var tr = "<tr>";
tr += "<td>" +list[i]['date']+"</td>";
tr += "<td>" +list[i]['type']+"</td>";
tr += "<td>" +list[i]['kode']+"</td>";
tr += "<td>" +list[i]['nama']+"</td>";
tr += "<td>" +list[i]['sloc']+"</td>";
tr += "<td>" +list[i]['ka']+"</td>";
tr += "<td>" +list[i]['ppic']+"</td>";
tr += "</tr>";
$("#all_report tbody").append(tr);
$("#all_report").show();
}
return false;
}
});
});
The PHP code
<?php
include("../../Connections/koneksi.php");
$date_start=$_POST['date_start'];
$date_end=$_POST['date_end'];
$kode_mat=$_POST['kode_mat'];
$sloc=$_POST['sloc'];
$type=$_POST['get_type'];
$order=$_POST['order'];
if (empty($date_start) || empty($date_end) || empty($kode_mat) || empty($sloc) || empty($type) || empty($order)) {
// Data for Titik1
$sql = "SELECT * FROM kadar_air";
$query = mysqli_query($db,$sql);
$rows = array();
while($tmp= mysqli_fetch_array($query)) {
$rows[] = $tmp;
}
echo json_encode($rows);
mysqli_close($db);
}
else {
}
?>
And the Html Code for the Table
<table id="all_report" class='table table-bordered'>
<thead></thead>
<tbody></tbody>
</table>