How to add anchor to an AjaxLink.

Hi.

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.

thanks.

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())

{

if(&#33;isset(&#036;htmlOptions['href']))


    &#036;htmlOptions['href']='#';


&#036;ajaxOptions['url']=&#036;url;


&#036;htmlOptions['ajax']=&#036;ajaxOptions;


self::clientChange('click',&#036;htmlOptions);


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

}

And U should also check:

http://www.yiiframework.com/doc/api/1.1/CHtml#ajaxLink-detail

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.