well, first of all you can call prepend an /ajax/ to any URL in cake,
which makes your pages uses the ajax-layout (layouts folder) instead
of the default. Other way around is, that you force the ajax-layout in
your controller action like so: var $layout = 'ajax';

Both works and depends on what you want to do with that method besides
calling it with ajax. i found the /ajax/ thing to be more flexible.

Lets say you have a page where you list your users and you would like
to be able to update that list with ajax. For that, you should create
a method in you users controller and name it something like
"userlist".

In another view you can then use the ajax helper to create a ajax link
to that new action, which you could called like so:
/ajax/users/userlist/ (refer to the manual, helper section)

Here is some example code you could basicly place anywhere in your
views.. index maybe.

<div id="userlist"></div>
<?php echo $ajax->link('Get Userlist', '/ajax/users/userlist/',
array('update' => 'userlist')); ?>

Hope this helps

On 3/9/07, shafi <[EMAIL PROTECTED]> wrote:
>
> How to implement AJAX in Cake Php
>
>
> >
>


-- 
Regards, Kjell
www.m3nt0r.de

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to