ajaxLink Question

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?

Your parameters are not given correctly. They should be:



 <?php echo CHtml::ajaxLink('Approve', array('backend/approveComment', 'id'=> $comment->id),


                                                array('replace' =>  '#target') );?>


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.

It's better to write js code directly in this case.