标签:style io java ar sp cti on c amp
自己写的jsonp函数封装
getJsonp:function(url,fn){
var callback=‘c_brand_jsonp‘+String(Math.random()).replace(‘.‘,‘‘);
url=url+‘&callback=‘+callback;
var script=document.createElement(‘script‘);
script.id=‘c_brand_script‘;
script.type="text/javascript";
script.src=url;
document.getElementsByTagName(‘head‘)[0].appendChild(script);
window[callback]=function(json){
document.getElementsByTagName(‘head‘)[0].removeChild(document.getElementById(‘c_brand_script‘));
fn(json);
}
}
标签:style io java ar sp cti on c amp
原文地址:http://www.cnblogs.com/webcheng/p/3990642.html