【发布时间】:2017-06-27 17:50:28
【问题描述】:
我正在渲染ajax表单
public function actionUser()
{
$model = new UserInfoForm();
$model->user_id = $this->user->id;
$validation = $this->performAjaxValidation($model);
if(null !== $validation){
return $validation;
}
$user = Yii::$app->user->identity;
return $this->renderAjax('user.php',[
'error' => $error,
'user' => $user,
'model' => $model
]);
}
在 user.php 中,我有以下行来获取所有用户公司和工作
<a href="<?= Url::to(['user/details', 'id' => $user_id]) ?>">Show User Companies and Jobs</a>
现在在用户详细信息操作中
public function actiondetails()
{
$model = new UserJobsForm();
$validation = $this->performAjaxValidation($model);
if(null !== $validation){
return $validation;
}
$companies = Companies::getUserCompanies();
$jobs = BlogPost::getUserJobs();
return $this->renderAjax('user_info.php',[
'error' => $error,
'model' => $model,
'companies' => $companies,
'jobs' => $jobs
]);
}
在我的 user_info.php 视图页面中,我可以看到所有详细信息。我还看到了 user.php 视图页面,这是因为,我在 user.php 之上呈现了 user_info 页面。我的要求是不要在新页面中打开。所以我试图在 user.php 之上呈现。我想在 user_info.php 呈现后立即关闭 user.php。我该怎么做??
【问题讨论】:
-
提供更多信息并添加视图和控制器代码。
-
@stfsngue 我用控制器和视图编辑了我的问题
-
你是在模态对话框中渲染 user.php 和 user_info.php 吗?
-
是的,第二个模态对话框只显示在第一个模态对话框上。