0
为什么使用CI 3的响应是非常缓慢(> 3秒)通过使用jquery自动完成获取json数据。我已经使用CI 2以类似的代码测试了我的应用程序,但它只需要很短时间就响应1秒。Codeigniter 3自动完成响应速度慢吗?
这里我的代码(jQuery的):
autocomplete: {
source: function(request, response) {
$.ajax({ url : "<?php echo site_url();?>/area/kode_area_tag",
data: { query : request.term},
dataType: "json",
type: "POST",
success: function(data){
response(data);
list_data = data;
}
});
},
minLength: 4
}
和我的服务器端代码:
function kode_area_tag()
{
$list = array();
$post = trim($this->input->post('query'));
$sql = "SELECT nama from area where nama like '%$post%'";
$query = $this->db->query($sql);
foreach ($query->result() as $row)
{
array_push($list, $row->nama);
}
echo json_encode($list);
}
是我的代码或笨本身? 有没有人可以给一些建议? 谢谢
作为额外的我尝试使用pdo驱动程序太多,但没有什么区别,因为信息我使用数据库中的视图来获得性能之前做这些测试。 – navotera