Jump to content

Passing data between 2 controller functions


Go to solution Solved by requinix,

Recommended Posts

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');
    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


Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Solution

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.

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.