How to add anchor to an AjaxLink.


I tried to add an anchor to my ajax link without any success.

And din’t find any sibject on this.

could you help me plz?

This is my link :

<?php echo CHtml::ajaxLink('La cellule architectes', array('dirRestauration'), array('update'=>'#updateContent'),array('id'=>'link02','class'=>'')); ?>

And I want to go on the anchor ‘archi’ on the page called by my ‘site/dirRestauration’ action.


If I got it understood right your problem, all U should do is to add ‘href’ key and value to HtmlOptions.

This is from doc:

public static function ajaxLink($text,$url,$ajaxOptions=array(),$htmlOptions=array())







return self::tag('a',&#036;htmlOptions,&#036;text);


And U should also check:

Hi, new to here. Is this also ok with creating an EMPTY anchor-only link?

yes you can create empty link

public static string ajaxLink(string $text, mixed $url, array $ajaxOptions=array ( ), array $htmlOptions=array ( ))

the URL for the AJAX request. If empty, it is assumed to be the current URL. See normalizeUrl for more details.