Ajax response of rendered gridphp ($out) not showing rendered in the screen.

QuestionsAjax response of rendered gridphp ($out) not showing rendered in the screen.
Zeead Tanjim asked 2 years ago

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/

1 Answers
Abu Ghufran Staff answered 2 years ago

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");
_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

1 + 19 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?