这是我的代码我想要检索FirstName,ComapnyName,名称, PersonalEmail和PersonalWebsite
while ($row = mysqli_fetch_array($query))
{
$e = array();
$e[] = $index;
$e[] = $row["FirstName"];
$e[] = $row["CompanyName"];
$e[] = $row["Designation"] ;
$e[] = $row["PersonalEmail"];
$e[] = $row["PersonalWebsite"] ;
$data[] = $e;
$index++;
}
$json_data = array(
"draw" => intval( $requestData['draw'] ),
"recordsTotal" => intval( $totalData ),
"recordsFiltered" => intval( $totalFiltered ),
"data" => $data //How To Retrieve This Data
);
echo json_encode($json_data);
我想在这里检索数据
$.ajax({
url:'assets/ajax/contact_list-load.php',
async:false,
success:function(result)
{
//I want to use all data here
}
)},
答案 0 :(得分:0)
使用jQuery: 在您的HTML中必须导入它
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js">
</script>
然后
<script>
$.ajax({
url: "pathtoyourfileWhereIsYour.php",
context: document.body
}).done(function(data) {
$('body').append( "<div>" + data.draw + "</div>" );
$('body').append( "<div>" + data.recordsTotal + "</div>" );
});
</script>