$this->set('provinces', $this->City->Province->find('list',
array('conditions' =>
array('province.country_id' =>
$this->params['url']['countryId']),
'recursive' => -1)));
echo json_encode($provinces);
}
Should be:
echo json_encode($this->City->Province->find('list',
array('conditions' => array('province.country_id' => $this-
>params['url']['countryId']),'recursive' => -1)));
On Apr 22, 9:55 am, cricket <zijn.digi...@gmail.com> wrote:
> On Fri, Apr 22, 2011 at 2:17 AM, pedro sastre <pdrsas...@gmail.com> wrote:
> > I have included the json_encode echo ($ provinces) and the action continues
> > without returning kos edit json values. Add action in l if I return the
> > values.
>
> > my controller
>
> > <?php
>
> > class CitiesController extends AppController {
>
> > var $name = 'Cities';
> > var $components = array('RequestHandler');
>
> > public function obtener_provincias() {
> > if (!empty($this->data['City']['province_id'])){
> > $this->data = "";
> > if ($this->RequestHandler->isAjax()) {
> > $this->set('provinces', $this->City->Province->find('list',
> > array('conditions' =>
> > array('province.country_id' =>
> > $this->params['url']['countryId']),
> > 'recursive' => -1)));
> > echo json_encode($provinces);
>
> $provinces does not exist. You're setting a view var named $province.
> But this isn't the view. Either assign the value of find('list') to
> $provinces instead of calling set() or take out the echo and create a
> view template and use an AJAX layout.
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment