Использую https://github.com/johnitvn/yii2-ajaxcrud
мне необходимо при удачном сохранении данных перенаправить на нужную страницу, не совсем понимаю как это сделать:
Код: Выделить всё
public function actionCreate($prefix)
{
$request = Yii::$app->request;
if($request->isAjax){
Yii::$app->response->format = Response::FORMAT_JSON;
if($request->isGet)
return $this->getResponseCreate();
else if($this->model->load($request->post())){
if($this->model->save()){
return $this->redirect($this->returnCreateUrl);
}
return $this->getCfgDataSave(
'success',
$this->msgSuccessSave
);
else
return $this->getCfgDataSave('error',$this->msgErrorSave);
}
else return $this->getResponseCreate();
}
else{
if ($this->model->load($request->post()) && $this->model->save()) {
return $this->redirect($this->returnCreateUrl);
} else {
return $this->render('create');
}
}