public function actionCreate()
    {
        $model = new Categories;

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            if (Yii::$app->request->isAjax) 
            {
                header('Content-type: application/json');
                echo Json::encode(['status'=>'DONE','model'=>$model]);
                exit();
            }
            else
            {
                return $this->redirect(['view', 'id' => $model->id]);
            }
        }
        return $this->render('create', [
            'model' => $model,
        ]);
    }