Using the Yii class from a php file loaded from javascript

I have almost zero experience in web development, so sorry if this is a stupid question.

I have a status table that needs refreshing every 10 seconds. So in my view file i have:


<script src="jquery.min.js" type="text/javascript"></script>


<script type="text/javascript">


$(function() {


    getStatus();


});


function getStatus() {


    $('div#status').load('getstatus.php');

    setTimeout("getStatus()",1000);


}

I’d like for the getstatus.php file to access the database connection and create the table that would be shown in the status div. If I drop the getstatus.php file in the base folder of the site, I get:


Fatal error: Class 'Yii' not found in /opt/lampp/htdocs/yii/www/my_project/getstatus.php on line 12

How can I access the Yii class in this case? Since I’m loading the getstatus.php file from javascript, I assume I cannot access the protected folder where all the other php scripts are.

Thank you.

try:




function getStatus() {


    $('div#status').load('LinkToControllerAndAction'); // Example: $this->createUrl('site/getStatus')

    setTimeout("getStatus()",1000);


}



Create Action "getStatus" in SiteController




class SiteController extends CController{


    .......................


    public function actionGetStatus(){

        ..........

        $this->renderPartial("getStatus", array(

            // Passing Arrays

        ));

    }


    .......................


}



Create view file "getStatus.php" in Controler View

That works great, thanks!