Quick Example Of Ajaxbutton

Hi all, I have been scouring the internet for a quick template/usage of the ajaxButton to update a DB value of a record and managed to solve it so putting a solution here for reference should there be more noobs like me out there.

View Page


 echo CHtml::ajaxButton('Approve', array('controllerID/actionID','val1'=>$val1), array('update'=>'#status'), 

array('confirm'=>'Please Confirm'));


//Display

<div id="status"> Current Status: <?php echo 'Old Status' ?></p></div>													



Controller




public function actionApprove(){

$command = Yii::app()->db->createCommand();

$command->update('myDb', array('status' => '4',

	                ), 'id=:id', array(':id' => $_GET['val1']));

	    echo 'STATUS: '4';	  


	}