动态加载 JS 文件
var xhr = new XMLHttpRequest;
xhr.open('get','//web.test.com/js/common/jq.js',true);
xhr.onreadystatechange = function(){
if( xhr.readyState == 4 ){
if( xhr.status >=200 && xhr.status < 300 || xhr.status == 304 ){
var script = document.createElement('script');
script.type = 'text/javascript';
script.text = xhr.responseText;
document.body.appendChild(script);
}
}
};
xhr.send(null);
标签:status,script,text,js,xhr,ajax,document,加载
From: https://blog.51cto.com/jinliang/8599171