当我点击保存此作业按钮时,会重定向到Jobsaves / savejobs / 1。如何不重定向,留在此页面job / view / 1
在Jobsaves控制器
中 if ($this->Jobsaves->save($jobsave)) {
$this->Flash->success(__('The jobsave has been saved.'));
//return $this->redirect();
} else {
$this->Flash->error(__('The jobsave could not be saved. Please, try again.'));
}
在
<?php echo $this->Html->Link('Save This Job',['controller'=>'Jobsaves','action'=>'savejob',$job->id],['class'=>'btn btn-success']); ?>
答案 0 :(得分:1)
我认为你应该像这样重定向到引用者:
if ($this->Jobsaves->save($jobsave)) {
$this->Flash->success(__('The jobsave has been saved.'));
return $this->redirect($this->referer());
} else {
$this->Flash->error(__('The jobsave could not be saved.
Please, try again.'));
}