SibinF
SibinF

Reputation: 385

Passing variable from view to element in cakephp

I have a view file add_rates.ctp and in that there is one select box . when i change the optiion, it will make a ajax call and fetch some values from the controller and load an element in that view. but my problem is iam not getting the parameter values in the element. i am getting params in rates.ctp

$params=$this->params['pass'];

it will return an array of parameters. but when i tried this in element i am not getting the value. also i tried to set a value in the add_rates.ctp and try to access in element, that is also not working

$this->set('params',array($params));

what to do..if anybody have idea about this please reply.. i get stucked ...

Upvotes: 1

Views: 3865

Answers (1)

Progredi Digital
Progredi Digital

Reputation: 341

If $params is the array you are trying to pass, then try this:

<?php $this->element('your-element-name', array('params' => $params)); ?>

Upvotes: 4

Related Questions