Yii простой bootstrap progressbar

Yii простой bootstrap progressbar
Во вьюшке:
<div class="progress progress-striped active" id="progressouter">
   <div class="bar" id="progress"></div>
</div>

<script type="text/javascript">
function show_progress() 
{   
    var url = '<?php echo Yii::app()->controller->createUrl("GetProgressBarData"); ?>';
    $.getJSON(url, function(data) {
        var percent = parseInt(data.percent);

        $("#progress").css('width',percent+'%');
        $("#progress").html(percent+'%');

        if (percent == 100) {
        $("#progressouter").removeClass("active");
        $("#progress").html("Done");
        } else {
            setTimeout("show_progress()", 3000);                    
        }
    });
}
show_progress();
</script>

Контроллер:
        public function actionGetProgressBarData() {
            $percent = ParserLinks::model()->getPercent();
            $data = array('percent'=>$percent);
            echo json_encode($data);  
        }
		
Модель:
        public function getPercent() {
            $percent = 0;
            $index=ParserLinks::model()->count('status=2'); //enum 0->1, 1->2
            $count=ParserLinks::model()->count();
            if ($count>0)
            $percent = intval($index/$count * 100);
            return $percent;
        }