I am using bootstrap and codeigniter framework in my project … I’m using ajax to post data and receive response of the rendered phpgrid output ($out) and loading into a <div> in a page (the page which already has all the required css and js sources for the gridphp). Browsers debug tool shows $out is loaded in the <div> but it is not displaying on the screen. what could be the possible reason?
My ajax call:
function searchKPI () {
$.ajax({
type: “POST”,
url: “<?= base_url(‘kpi_request’)?>”,
data: $(‘#frm_kpi_req’).serialize(),
dataType: “html”,
success: function(response, status) {
//alert(response);
$(‘#kpioutput’).html (response);
},
error: function() {
alert(‘Error occured’);
}
});
};
My CI Controller:
public function kpi_request () {
$input = array (
“switch” => $this->input->get(‘switch’),
“o_type” => $this->input->get(‘o_type’),
“o_entity” => $this->input->get(‘o_entity’),
“t_type” => $this->input->get(‘t_type’),
“t_entity” => $this->input->get(‘t_entity’),
“pd_time” => $this->input->get(‘predefined_time’),
“kpitimerange” => $this->input->get(‘kpitimerange’),
“dialcode” => $this->input->get(‘dialcode’),
“display” => $this->input->get(‘displayformat’)
);
$this->load->model(‘kpi_result’);
$data[‘out’] = $this->kpi_result->fetch_data($input);
echo $data[‘out’];
}
** PS: The model returns rendered $out/
Hello,
You can refer this demo which uses ajax to reload grid in a div.
https://gist.github.com/gridphp/e8dc9add4a8edacc255c9da46b4ba426
Line 188
This is the code which is used to load via ajax:
$("#master_div").load("?grid_id=list1&oper=ajaxload");