jquery - Saving data with Ajax in Yii -


i've created ajax action in controller in order save specific data in post. dont need render view.

my jquery script doing following

$("#buttonextend<?php echo $this->post_row;?>").click(function(e){             $.ajax({                type: "post",                url: "<?php echo yii::app()->createurl('post/extend', array('id' => $data['id'])); ?>",                           });         }); 

and action extend contains following

protected function actionextend($id)     {         $model=$this->loadmodel($id);            if(yii::app()->request->isajaxrequest) {               $model->todate = '10/10/2013';              $model->save();     } 

}

when checked record in mysql, to_date field not filled.

even though updated field, updated in beforevalidate function in model updated.

where mistake?

thank in avdance help

i think should check data type of field 'to_date' in database table.

if datetime time need specify date time in format for eg :'2014-02-04 19:39:12'.

also try print model attributes after model->save() (print_r($model->attributes)).

this may you.

thanks.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -