Answer the question
In order to leave comments, you need to log in
I need to asynchronously load a script that will be executed after that in Yii 2. How can I achieve this (without jQuery)?
I need to asynchronously load a script to be executed after that in Yii 2 . How can this be achieved (without jQuery)?
I would be grateful for ideas.
Answer the question
In order to leave comments, you need to log in
I don't know how Yii 2 uses scripts, but you can download it like this:
var s = document.createElement('script');
s.src = '/script.js'; // путь до нужного скрипта
s.async = true;
s.onload = s.onreadystatechange = function() {} // функция сработает сразу после загрузки скрипта
document.head.appendChild(s);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question