Reputation: 2107
When i click Save This Job Button, There is redirect to Jobsaves/savejobs/1. How to do not to redirect, stay on this page job/view/1
In Jobsaves Controller
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.'));
}
in Jobs/View/1
<?php echo $this->Html->Link('Save This Job',['controller'=>'Jobsaves','action'=>'savejob',$job->id],['class'=>'btn btn-success']); ?>
Upvotes: 0
Views: 63
Reputation: 106
I think you should redirect to referer like this:
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.'));
}
Upvotes: 1