VincentM
(Meert Vincent)
1
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(!isset($htmlOptions['href']))
$htmlOptions['href']='#';
$ajaxOptions['url']=$url;
$htmlOptions['ajax']=$ajaxOptions;
self::clientChange('click',$htmlOptions);
return self::tag('a',$htmlOptions,$text);
}
And U should also check:
http://www.yiiframework.com/doc/api/1.1/CHtml#ajaxLink-detail
mindylynn0
(Lynnmindy260)
3
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.