Answer the question
In order to leave comments, you need to log in
How to load another view with js with code inside using Ajax in Yii2?
The current view has a modal window.
When the window pops up, it is loaded using xmlhttprequest with the result of rendering the view, which has html markup and the js code applicable to it.
An example of the content of the view (which is being loaded):
<div>
...
</div>
<?php
$this->registerJs('console.log("smth")');
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question