wendux/Ajax-hook
Ajax-hook 原理解析
Js 拦截全局ajax请求
js实用方法记录-js动态加载css、js脚本文件
js 拦截全局 ajax 请求
JavaScript、ES5和ES6的介绍和区别
function dynamicLoadJs(url, callback) {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
if(typeof(callback)=='function'){
script.onload = script.onreadystatechange = function () {
if (!this.readyState || this.readyState === "loaded" || this.readyState === "complete"){
callback();
script.onload = script.onreadystatechange = null;
}
};
}
head.appendChild(script);
};dynamicLoadJs('https://unpkg.com/ajax-hook/dist/ajaxhook.min.js',function(){alert('加载成功')});