【发布时间】:2017-01-31 16:44:40
【问题描述】:
我有医生的数据库表,其中列出了近 100 多个医生,这是我的医生 PHP 代码 dc.php :
$conn= mysqli_connect('localhost', 'root', '', 'test');
$query = mysqli_query($conn, "select * from doctors");
while($result=mysqli_fetch_array($query)){
$dc_name = $result['name'];
$dc_img = $result['image'];
$dc_email = $result['email'];
echo $dc_name."||".$dc_img."||".$dc_email;
}
I want echo all doctors another main page index which already fixed large layout with bootstrap,html,css by using ajax calling on click
Here is my code for ajax
$(function(){
$(".divscrolla").on("click", function(){
$.ajax({
url:'db.php',
type:'POST',
data:{"data":$(this).val()},
success:function(data){
var splitted = data.split("||");
$("#result_name").html.splitted[0];
$("#result_img").html.splitted[1];
$("#result_email").html.splitted[2];
}
});
});
这里我想通过 AJAX 显示所有 100 条记录
但在这里我只得到第一个元素,但我在数据库中有更多的 100 条记录。
如何通过简化来解决?
【问题讨论】:
标签: php jquery ajax performance