Here I am using CJuiDialog box. I have no problem with adding values in the form. It is successfully inserted in the database.
My problem is that echo "Sucessfully Added"; is not displaying in timetable.php after saving the values. Plz any help me.
timetable.php
echo CHtml::ajaxLink(Yii::t('job','Create Job'),$this->createUrl('TimetableEntries/settime'),array(
'onclick'=>'$("#jobDialog").dialog("open"); return false;',
'update'=>'#jobDialog','type' =>'GET','data'=>array('batch_id'=>1,'weekday_id'=>4,'class_timing_id'=>7),'dataType'=>'text',
),array('id'=>'showJobDialog')) ;
<div id="jobDialog"></div>
TimetableEntriesController.php
public function actionSettime()
{
$model=new TimetableEntries;
$this->performAjaxValidation($model);
$flag=true;
if(isset($_POST['TimetableEntries']))
{
$flag=false;
$model->attributes=$_POST['TimetableEntries'];
if($model->save()) {
//Return an <option> and select it
echo "Sucessfully Added";
}
}
if($flag)
{
Yii::app()->clientScript->scriptMap['jquery.js'] = false;
$this->renderPartial('create',array('model'=>$model,'batch_id'=>$_GET['batch_id'],'weekday_id'=>$_GET['weekday_id'],'class_timing_id'=>$_GET['class_timing_id']),false,true);
}
}