gambozygame
gambozygame

Reputation: 489

codeigniter loading one view in to another getting the variables

When loading one view in to another with jquery i do that.

In file view 5

load("<?php echo site_url("controller/name")?>");

I'm loading the name function that contains the view.But how to get the variables from that name function that is loading a view in to that view ?

function name(){
 $a['aa'] = 1;
 $this->load->view("file",$a);
}

And i wan to load the $aa variable where i'm loading the function with jquery , this is the loaded function - name, the default view is different and with different function in the controller.

Upvotes: 0

Views: 603

Answers (1)

Darren
Darren

Reputation: 11011

Why don't you pass the $aa through the controller like this?

    function name($aa = 1) {
          $this->load->view('file', $aa);
    }

Then you can do load('<?php echo site_url('controller/name/1') ?>');

You might want to sanitize $aa as well.

Upvotes: 1

Related Questions