动态Script 解决跨域问题
1.动态创建script
createScript : function(src)
{
var varScript = document.createElement("script");
if (src != "") {
varScript.src = src;
}
varScript.language = "javascript";
varScript.type = "text/javascript";
document.body.appendChild(varScript);
}
src:url(跨域地址)?参数列表n=值n&callback=callbackMethod
2.回调方法callbackMethod
function callbackMethod(data){
}
时间: 2024-10-22 22:58:47