I am working on PHP CodeIgniter. By clicking on customer name I call a JavaScript function customerBasic
for some other purpose that also call show_cs_info
that send AJAX call to controller as below.
AJAX function:
function customerBasic(customer_id,isConsumer, name )
{
document.getElementById('random').value = customer_id+"/"+name;
$.ajax({
url: site_url+"customer/connections/index/"+customer_id+"/"+0+"/"+isConsumer,
type: 'post',
success: function(data)
{
show_cs_info(customer_id);
}
});
}
show_cs_info
function:
function show_cs_info(id)
{
$.ajax({
url:site_url+"customer/customer/show_cs_info"+"/"+id+"/"+'no',
type:'post',
success:function(data)
{
$('#right_div').html(data);
}
});
}
controller
public function show_cs_info($id, $bit)
{
$id = urldecode($id);
$bit = urldecode($bit);
$this->load->model('customer_model');
$data['val']= $this->customer_model->show_cs_info($id);
$this->load->view('show_cust_info_view',$data);
}
Model
public function show_cs_info($id)
{
$this->db->where('customer_id',$id);
$result = $this->db->get('customer_info');
return $result->result();
}
The AJAX call is taking 1.05s. How can I make it faster?