how to pass the database fetched values from controller to view page using ajax and json.i have a controller and model code but i dont know how to pass values from controller to view page
Controller
public function supplier_get_data(){
$query = $this->Profile_model->supplier_communication();
echo json_encode($query);
}
model
public function supplier_communication(){
$sql = $this->db->get('communication');
$sql = $sql->result_array();
return $sql;
}
view page
<div class="left">
<div class="row">
<div class="col-md-1">
<img src="<?php echo base_url(); ?>images/xxxx.jpg" class="img-circle" width="30px" height="30px"/>
</div>
<div class="col-md-11">
<div class="left_msg_block">
<div class="left_messagetext"><a href="#" data-toggle="tooltip" title="time">here i want to display the database values</a></div>
</div>
</div>
</div>
</div>
<a href="#" data-toggle="tooltip" title="time">value1</a> <a href="#" data-toggle="tooltip" title="time">value2</a>