2012-02-22 14:55



i installed this extension , is possible when i make an ajax request to unload from 'preload'=>array('bootstrap','log'), : bootstrap ,i don't need to use bootstrap on ajax request , how to avoid that

<link rel="stylesheet" type="text/css" href="/tamada/assets/97e8be51/css/bootstrap.min.css" />
Content updated in AJAX<script type="text/javascript" src="/tamada/assets/cb84ef9f/jquery.min.js"></script>
<script type="text/javascript" src="/tamada/assets/97e8be51/js/bootstrap-button.js"></script>
<script type="text/javascript" src="/tamada/assets/97e8be51/js/bootstrap-tooltip.js"></script>
<script type="text/javascript" src="/tamada/assets/97e8be51/js/bootstrap-popover.js"></script>
<script type="text/javascript">

Thank You A LOT , sorry for my english

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • douyou7102 douyou7102 9年前

    You can selectively load it in your config/main.php.

    This might not be the best PHP but it should work. Basically, when loading the config, check whether the request is an AJAX request or not using Yii::app()->request->isAjaxRequest.

    Add to top of config/main.php:

    // Load it by default
    $preload = array('bootstrap');
    // Don't load it for AJAX requests
    if (Yii::app()->request->isAjaxRequest) {
        $preload = array();

    Then pull in the module (either toggled on or off) using array_merge:

    // preloading 'log' component (with selective bootstrap component)
    'preload'=>array_merge(array('log'), $preload),

    Now when you do an AJAX request to your application the bootstrap module should not be loaded.

    点赞 评论 复制链接分享
  • dowbwrr3590709 dowbwrr3590709 9年前
    点赞 评论 复制链接分享