4
我使用bootstap tabs,我試圖通過ajax加載內容,而不是將其設置爲PHP。我的代碼:Yii-bootstrap標籤事件處理程序
<script type="text/javascript">
function test(e){
console.log(e.target);
//load ajax stuff here
}
</script>
<?php
$this->widget('bootstrap.widgets.TbTabs', array(
'type'=>'tabs',
'placement'=>'above', // 'above', 'right', 'below' or 'left'
'tabs'=>array(
array('label'=>'Ogólne', 'content'=>'Czekaj...', 'active'=>true),
array('label'=>'Książka adresów', 'content'=>'Czekaj...'),
array('label'=>'Cośtam', 'content'=>'Czekaj...'),
),
'events'=>array('shown'=>'test')
)); ?>
不過,我不斷收到此錯誤: Uncaught TypeError: Object test has no method 'apply'
。我試圖創建一個對象,但它仍然無法工作。有任何想法嗎?
一點澄清,由框架創建JS代碼:
<script type="text/javascript">
/*<![CDATA[*/
jQuery(function($) {
jQuery('a[rel="tooltip"]').tooltip();
jQuery('a[rel="popover"]').popover();
jQuery('#yw0').tab('show');
jQuery('#yw0').on('shown', 'test');
jQuery('#collapse_0').collapse({'parent':false,'toggle':false});
});
/*]]>*/
</script>