Tuesday, November 20, 2012

update <div> on ajax link call

hi guys,... how can I update <div id="group_<?php echo $group['Group']['id'] ?>"> on ajax call function...? 
my controller functions are working well,.. but I need to update <div id"=.....> when user is join this group, and when user is a group member, so "leave" link will display,... 

I have tried to add 'frequency' => 5 but no luck,...

<div id="group_<?php echo $group['Group']['id'] ?>">
<?php if(!$user->is_group_member($group['Group']['id'])): ?> // This is from my User helper,... 
<?php echo $ajax->link(ucfirst(__('join', true)), array('controller' => 'groups', 'action' => 'ajax_join', $group['Group']['id']), array('class' => 'join-group', 'title' => ucfirst(__('join this Group', true)), 'style' => 'font-weight: bold; font-size: 12px; color: #1115D0;', 'update' => "group_".$group['Group']['id'])); ?>
<?php else: ?>
<?php echo $ajax->link(ucfirst(__('leave', true)), array('controller' => 'groups', 'action' => 'ajax_leave', $group['Group']['id']), array('class' => 'exit-group', 'title' => ucfirst(__('leave this Group', true)), 'style' => 'font-weight: bold; font-size: 12px; color: red;', 'update' => "group_".$group['Group']['id'])); ?>
      <?php endif ?>
</div>

thanks in advance, 
chris 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: