H
H
hollanditkzn2017-06-01 18:47:24
JavaScript
hollanditkzn, 2017-06-01 18:47:24

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()');
    }

If you take it on pure js code, then it is implemented on the same page where the anchor is something like this
$('.id_zakaz').on('click', function(){
    var key = $(this).data('key');
    var id = $('#'+key).click();
  });

But I have a problem if the controller goes how to write this code?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Fedortsev, 2017-06-01
@a1exFed

If you take on pure js code...

I read, there are questions ... And the conviction is growing stronger and stronger that 50% of js cannot be distinguished from jQuery ...
And describe the necessary behavior, humanly.
how to implement it in php
And 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 question

Ask a Question

731 491 924 answers to any question