> I have an ajax link that will toggle if the user is confirmed or not without
> reloading the page.
>
> <td><?php
> echo($ajax->link($user['User']['confirmed'], array('controller' => 'users',
> 'action' => 'confirm/'.$user['User']['id']), array(), 'Update Confirmation
> for " '.$user['User']['username'].' "'));?></td>
>
> How do I get the link text to update when I click on the link? I am a bit
> new to using ajax/javascript so any help would be wonderful.
You should inform the elementd which you wanna update with
the 'update' key of the options to the link() method. Something
like this should work.
...
echo $ajax->link('Click here', null, array(
'url'=> '/users/confirm/'.$user['User']['id']
, 'update'=> 'elementIdToUpdate')
, 'Update confirmation for' . $user['User']['username']); ?>
<div id="elementIdToUpdate"></div>
Check this out too for more info:
http://api.cakephp.org/class/ajax-helper#method-AjaxHelperlink
http://book.cakephp.org/view/209/AjaxHelper-Options
Best regards.
--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105
http://mfandrade.wordpress.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment