jQuery.getScript加载同域JS为xhr请求,导致firebug不能正常读取js,因此不能够断点该js
解决方法,用以下方法加载js:
var loadScript = function(url, callback, charset){
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
if(charset){
script.charset = charset;
}
script.src = url;
if(!callback){
return;
}
script.onload = script.onreadystatechange = function(){
if(!this.readyState || this.readyState==='loaded' || this.readyState==='complete'){
callback();
}
};
head.appendChild(script);
};
您可能感兴趣的文章: