echojson_encode(array('result'=>true,'data'=>'Valid Data, Saving succeeded'));// Use CJSON::encode() instead of json_encode() if you are encoding a Yii model
Yii::app()->end();// Properly end the appÏ
}else{
// Validate ok! Saving your data from form failed!
// Send a response back!
header('Content-type: application/json');
echoCJSON::encode(array('result'=>false,'data'=>'Valid Data, Saving failed','model'=>$this->model));// Use CJSON::encode() instead of json_encode() if you are encoding a Yii model
Yii::app()->end();// Properly end the appÏ
}
}
}
// Validate ok! Saving your data from form okay!
// Validate not ok!
// Send a response back!
header('Content-type: application/json');
echojson_encode(array('result'=>true,'data'=>'$modelDataOrSomeJunkToGiveBackToBrowser'));// Use CJSON::encode() instead of json_encode() if you are encoding a Yii model
Yii::app()->end();// Properly end the appÏ
header('Content-type: application/json');
echojson_encode(array('result'=>false,'data'=>'No Valid Data'));// Use CJSON::encode() instead of json_encode() if you are encoding a Yii model
Yii::app()->end();// Properly end the appÏ
}
}
// Uncomment the following methods and override them if needed
...
...
@@ -70,4 +140,4 @@ class MessageController extends Controller {