S
S
sergeysd2016-08-14 14:06:47
Yii
sergeysd, 2016-08-14 14:06:47

How to add script to Yii2 header after ajax?

Greetings!
I added a slider script to the page in the header using the /frontend/assets/FrontendAssets.php file.
I make an ajax request, the slider itself is formed from a set of slides and returned as html.
But it doesn't work. You need to connect the script after the response with the slider is returned.
How to do it in Yii2? That is, in a good way, it needs to be connected in the controller, but how?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-08-14
@sergeysd

Good afternoon.
Try
$this->registerJsFile(.......);
Details here
ps "in a good way, it needs to be connected in the controller, but how" You should not connect it in the controller

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question