CActiveForm ajax submit

What about a possibility to send valid data to controller via ajax request in CActiveForm?

I mean, add some functionality to yiiactiveform like this:




<?php $form = $this->beginWidget('CActiveForm',

            array('id' => 'add-comment',

                'action' => Yii::app()->createUrl('comments/add'),

                'enableAjaxValidation' => true,

                'clientOptions' => array('validateOnSubmit' => true,

                                         'validateOnChange' => false,

                                         'submitViaAjax' => true,

                                         'submitResponseType' => 'json',

                                         'afterFormSubmitted' => 'js:function(json) { alert (1); }'),

                ));

            ?>



If there are no errors in validation and submitViaAjax is set to true, Controller returns to ‘afterFormSubmitted’ function some answer in ‘submitResponeType’ type.