[英]Ensure load of javascript before proceed
I have following js includes: 我有以下js包括:
<script src="~/js/api/config.js"></script>
<script src="~/js/authentication.js"></script>
<script src="~/lib/es6-promise-polyfill/promise.min.js"></script>
<script>Vue.use(VeeValidate)</script>
<script src="~/js/home.js"></script>
authentication.js
has an ajax call. authentication.js
有一个ajax调用。 home.js
must not be called before authentication and its ajax
calls has completed. 身份验证及其
ajax
调用完成之前,不得调用home.js
Is this possible? 这可能吗?
You can call the following function from xmlhttp.onreadystatechange
event 您可以从
xmlhttp.onreadystatechange
事件调用以下函数
function loadJS() {
var s = document.createElement("script");
s.type = "text/javascript";
s.src = '/js/home.js';
document.getElementsByTagName('head')[0].appendChild(s);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.