Función A Partir De Un Case ?

Mi código es el siguiente




<?php if (!Yii::app()->user->isGuest) {

?>

<?php $selectedTab=isset($_POST['selectedTab'])? $_POST['selectedTab']:$_GET['selectedTab'] ;

$tab0=false;

$tab1=false;

$tab2=false;

$tab3=false;

$tab4=false;


switch ($selectedTab) {

    case 1:

        

        $tab1=true;


        

        break;

    case 2:

        $tab2=true;

        break;

    case 3:

        $tab3=true;

        break;

}


?>

<script type="text/javascript">var accion='<?php echo $selectedTab; ?>' ;</script>




<?php $this->widget('bootstrap.widgets.TbTabs', array(

        'id' => 'mytabs',

        'type' => 'tabs',

        'tabs' => array(

                array('id' => 'tab0', 'label' => 'Bienvenido', 'content' =>'<center> <h1>BIENVENIDO A '.CHtml::encode(Yii::app()->name)."<br><img src='http://localhost/yii/kpataz/images/img1.gif '>  </center>", 'active' => $tab0),

                array('id' => 'tab1', 'label' => 'Registrar Vehiculo', 'content' => 'loading ....', 'active' => $tab1),

                array('id' => 'tab2', 'label' => 'Registrar Personas', 'content' => 'loading ....', 'active' => $tab2),

                array('id' => 'tab3', 'label' => 'Estado legal Vehiculos', 'content' => 'loading ....', 'active' => $tab3),

                array('id' => 'tab4', 'label' => 'Estado legal Personas', 'content' => 'loading ....', 'active' => $tab4),

               




        ),

        'events'=>array('shown'=>'js:loadContent')

    )

);?>





<script type="text/javascript">


function loadContent(e){


    var tabId = e.target.getAttribute("href");


    var ctUrl = '';


    if(tabId == '#tab1') {

        ctUrl = '<?php echo $this->createUrl('getvehrs/index')?>';







    } 


    if(tabId == '#tab2') {

        ctUrl = '<?php echo $this->createUrl('getperrs/index')?>';

    }

    if(tabId == '#tab3') {

        ctUrl = '<?php echo $this->createUrl('geteslvs/index')?>';

    }

    else if(tabId == '#tab4') {

        ctUrl = '<?php echo $this->createUrl('geteslps/index')?>';

    }


    if(ctUrl != '') {


        $.ajax({


  

            url      : ctUrl,

            type     : 'POST',

            dataType : 'html',

            cache    : false,

            success  : function(html)

            {

                jQuery(tabId).html(html);

            },

            error:function(){

                    alert('Request failed');

            }

        });

    }


    preventDefault();

    return false;

}


</script>





<?php } ?>



cuando entro a cada tab en el momento de cancelar alguna entrada o guardar la tab me devuelve “selectedTab” lleno con un numero q indica la tab de la que biene :D

Bueno lo que quiero hacer es q cuando dicho variable llege se me ejecute el ajax q esta en el codigo y me traiga las respectivas vistas podrian ayudarme porfavor

O alguien que porfavor me diga como hago para regresar a determinada tab ¡ …