use CJuiDialog to send a message - How to link to a controller action?

I want to implement this feature:

user click the button on the page, than a dialog box pop up(e.g. CJuiDialog). User can input the short messang, and click ‘send’ button on this dialog window.

After the click, the message will be sent to its destination (e.g.: saved in database). Dialog box closed. Please refer to the photo.

By digging into many examples, I come up with the following code:

To initialize a CJuidialog


$this->beginWidget('zii.widgets.jui.CJuiDialog', array(

	'id'=>'mymodal',

	'options'=>array(

    	'title'=>'Joining A Firm',

    	'width'=>500,

    	'height'=>300,

    	'autoOpen'=>false,

    	'resizable'=>true,

    	'modal'=>true,

    	'closeOnEscape'=> true,

    	'overlay'=>array(

        	'backgroundColor'=>'#000',

        	'opacity'=>'0.8'

    	),

    	'buttons'=>array(

        	'Send'=>'js:function(){alert("OK");}',

        	'Cancel'=>'js:function(){$(this).dialog("close");}',	

    	),

	),

));

   

	echo '<span>Message to this company</span><br/>';

	echo CHtml::textArea('message');  // this generate the textarea

$this->endWidget('zii.widgets.jui.CJuiDialog');


?>

To call the dialog:





  <?php echo CHtml::Button('Join this firm',                    	

                    	array('onClick'=>'$("#mymodal").dialog("open");'

                        	)); 

?>




I feel it likes MVC in a CJuiDialog, but couldn’t sort it out myself.

This is as far as I can go by myself. How to link the send button with a controller action? so that user message can be processed?

Thank you!