Answer the question
In order to leave comments, you need to log in
How to make a redirect with an event?
I need that when the data is saved in the controller, a redirect is made that goes to the anchor and clicks on this anchor. But firstly I got an error Calling unknown method: frontend\controllers\NotificationController::registerJs() and I have no idea how to implement it in php, because little is written for this registerJs example.
public function actionNotification($id)
{
$model = $this->findModel(['id_zakaz' => $id]);
$model->active = 0;
$model->save();
return $this->registerJs('document.location.href = "http://crm/frontend/web/admin#"'.$id.'.click()');
}
$('.id_zakaz').on('click', function(){
var key = $(this).data('key');
var id = $('#'+key).click();
});
Answer the question
In order to leave comments, you need to log in
If you take on pure js code...
how to implement it in phpAnd what about JS?
document.location.href = " crm/frontend/web/admin# "Causes loading by href. click() is not needed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question