@cronet, i always make my Ajax Request as u tried.

I tried like you to use .json ext and it never worked for me, so i
parsed .ajax extension and all work fine.. you should try .ajax
extension.

On 18 mar, 10:12, cronet <[email protected]> wrote:
> That works very well... Thank you guys !
>
> On 18 Mrz., 12:28, LipeDjow <[email protected]> wrote:
>
> > Yes.
>
> > Instead returning the value in action, you can set it to view and load a
> > general element for JSON.
> > Like this (using Taffarel's example):
>
> > function json(){
> >     //bring some data in database
> >      $json = $this->Test->find('all');
> >      $this->set('json', $json);
> >      $this->render('../elements/json.ctp');
>
> > }
>
> > // views/elements/json.ctp
> > <?php echo json_encode($json); ?>
>
> > then in my view I use the method getJson
>
> > $.getJSON('<?php echo $this->Html->url(array('controller'=>'tests',
> > 'action'=>'json'))?>', function(data){
> >       $("div").append(data);
>
> > });
>
> > I think this will not break MVC.
>
> > HTH
> > LipeDjow

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to