Hi Milos,
Instead of calling an ajax layout, I think you simply should add this
line at the beginning of your action in the controller.

$this->autoRender = false;

This action  will only be executed on the server side.

And to send parameter to the action, why don't you send them in array
by  'post' method in Json encoding and receive the response from the
action the same way.
To do it, use this command:

$this-> Js->request

On 4 déc, 12:05,Miloš Vučinić <milosvuci...@gmail.com> wrote:
> Thank you very much !
>
> All the best,
> Milos
>
> On Dec 3, 9:25 am, Tilen Majerle <tilen.maje...@gmail.com> wrote:
>
>
>
>
>
>
>
> > for response: just create a view like (but not 'default' layout, make a new
> > layout 'ajax') in others functions
>
> > how to detect ajax: $this->request->is('ajax')
>
> > CONTENT FOR ajax.ctp layout:
> > <?php print $content_for_layout; ?>
>
> > and in controller to enable this layout:
> > $this->layout = 'ajax';
>
> > why this ? this will return just your 'archieve' view
>
> > --
> > Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> > 2011/12/3 Miloš Vučinić <milosvuci...@gmail.com>
>
> > > Hello,
>
> > > I haven't used AJAX so far because I never needed it. I read the
> > > manuals regarding it, now I am wondering how to do it in cake. My task
> > > is following:
> > > I have a list of users. Next to each user I have a button which says
> > > archive. On click I have to archive the user. Now, I don want to
> > > reload the whole page so I want to use AJAX.
> > > The way I see it, I would create a regular AJAX call to my url which
> > > is function just like any other in cake, like /users/archive/57 where
> > > number 57 is id in the database (it will be generated for each
> > > button).
> > > On server side I would perform the function, but how do I return
> > > response. Do I just echo it ? And how does the cake knows it was an
> > > AJAX call and that it needs to send a response to a client. And is it
> > > ok, for the response to be just a simple ok , or notok string , and
> > > then if ok, I just change the archive sting into yes from no in the
> > > user list.
>
> > > Can you please give me like quick steps of how would you do it with a
> > > quick syntax example.
>
> > > Like : 1) Create a client call to the server
> > >         2) Execute function on server the normal way you wold
> > >         3) Send response to client (please explain how)
>
> > > Thank you in advance,
>
> > > All the best
> > > Milos Vucinic
>
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > > athttp://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to