/** * Runs the action */ public function run() { Yii::$app->response->format = Response::FORMAT_JSON; $linkPreviewModel = new LinkPreviewModel(); $content = Yii::$app->request->post('content'); $linkPreview = new Crawler(['content' => $content]); $result = $linkPreview->getPagePreview(); return $this->controller->render($this->view, ['result' => $result, 'linkPreviewModel' => $linkPreviewModel]); }
/** * Runs the action */ public function run() { Yii::$app->response->format = Response::FORMAT_JSON; $linkPreviewModel = new LinkPreviewModel(); $content = Yii::$app->request->post('content'); $linkPreview = new Crawler(['content' => $content]); $result = $linkPreview->getPagePreview(); $pjaxContainerId = str_replace('#', '', Yii::$app->request->post('_pjax')); return $this->controller->render($this->view, ['result' => $result, 'linkPreviewModel' => $linkPreviewModel, 'pjaxContainerId' => $pjaxContainerId]); }