Dave
(Deventer)
June 5, 2009, 4:34pm
1
Hi quys,
I have a question on how the "replace" and "success" options are working.
I have the following link
<div >
<?php echo CHtml::ajaxLink('Approve', array('backend/approveComment',
array('id'=> $comment->id),
array('replace' => '#target')) );?>
</div>
The request will be succesfully executed and its result ist 'test'. But the content of the link will not be replaced.
The is also true if i provide a success function as follows:
function(html) {$('id').html(html)}
Any idea how this needs to be done?
qiang
(Qiang Xue)
June 8, 2009, 3:13am
2
Your parameters are not given correctly. They should be:
<?php echo CHtml::ajaxLink('Approve', array('backend/approveComment', 'id'=> $comment->id),
array('replace' => '#target') );?>
Dave
(Deventer)
June 8, 2009, 7:33am
3
Thanks qiang, now it works.
Is there a possability to mark a return value as 'false' so that its content will not be replaced? For example i want to approve a comment and if it failes for some reason I do not want its contents replaced thus the user can try again.
qiang
(Qiang Xue)
June 8, 2009, 12:06pm
4
It's better to write js code directly in this case.