KSI Posted October 31, 2021 Share Posted October 31, 2021 I have 2 view classes called indexreport and ajaxleadsreport. ajaxleadsreport fetches all the data and displays it. Now I have a GET variable that is being passed to indexreport which I want to be able to pass it to ajaxleadsreport to filter the current data according to the GET variable that has been passed. Controller Class: public function listsreport($slug='') { $status1 = $this->input->get('status'); print_r($status1); $main['content']=$this->load->view('crm/leads/indexreport',$content,true); } public function ajaxleadsreport($p='') { $output = array( 'html'=>$this->load->view('crm/leads/ajaxleadsreport',$content, true)); echo json_encode($output); } To put in simple words I want status1 to go to ajaxleadsreport controller Quote Link to comment https://forums.phpfreaks.com/topic/314151-passing-data-between-2-controller-functions/ Share on other sites More sharing options...
requinix Posted October 31, 2021 Share Posted October 31, 2021 Have you tried simply calling the ajaxleadsreport method? Quote Link to comment https://forums.phpfreaks.com/topic/314151-passing-data-between-2-controller-functions/#findComment-1591623 Share on other sites More sharing options...
KSI Posted November 1, 2021 Author Share Posted November 1, 2021 9 hours ago, requinix said: Have you tried simply calling the ajaxleadsreport method? Yea but that's not how my structure works. In my table, listsreport shows the actual view class and ajaxleadsreport shows the data for a table inside that view class. So I have to pass the GET data from listsreport to ajaxleadsreport since GET data is only able to show up in listsreport Quote Link to comment https://forums.phpfreaks.com/topic/314151-passing-data-between-2-controller-functions/#findComment-1591626 Share on other sites More sharing options...
Solution requinix Posted November 1, 2021 Solution Share Posted November 1, 2021 ajaxleadsreport is an action (not a controller) which means it gets invoked by the controller (which is the class) when it handles the route. If the indexreport view needs to render the ajaxleadsreport view then the listsreport action (method) should pass the necessary information into the indexreport view which will eventually pass the necessary information into the ajaxleadsreport view. So the ajaxleadsreport action (method) is not going to be used. Action renders view which renders another view. Quote Link to comment https://forums.phpfreaks.com/topic/314151-passing-data-between-2-controller-functions/#findComment-1591629 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.