douzhan1935
2013-10-22 04:53
浏览 56
已采纳

使用JQUERY使用PHP AJAX JSON显示所有数据

filePHP.php

$query = $kon->prepare("SELECT * FROM t_kategori");
$query->execute();
while($row = $query->fetch(PDO::FETCH_ASSOC))
{
    $json = array('id' => $row['id_kategori'], 'nama' => $row['nama_kategori']);
    echo json_encode($json);
}

and index.php

$.post('filePHP.php', function(data){
   console.log(data);
},'json');

but this not working, please solution ???? thankz

2条回答 默认 最新

相关推荐 更多相似问题