how to save data using jquery.ajax

Hi, I am still learning Yii,I have no problem if I am not using yii framework I can save my data to table using

jquery.ajax,but in Yii framework I am confuse how can I save my data if I am using jquery.ajax. can you please

help me on this.

Thank you in advance.

for example submitting the form




$('#btnsave').click(function(){

    

    $.ajax({

      type: 'post',

      data: $('#formId').serialize(),

      url:'controller/action',

      success:function(data){

        

       } 




    });




});




In the ‘action’ specified in url,you can take the data form $_POST array and save it on database

I could not figure it out how ?.I am confuse do I need to extract those Posted parameters in my controller ?

can you please show some snippet.

Thank you in advance.

Since you want to use jQuery serialize it would be easier to set ajax type to ‘get’ so you receive $_GET array in the action on the other side.

BUT THIS IS YII so instead of creating your own .click script use this

CHtml::ajaxSubmitButton

http://www.yiiframework.com/forum/index.php/topic/37075-form-validation-with-ajaxsubmitbutton/