Javascript 获取twitter共享计数,响应给出奇怪的输出
以上是我获取股票数量的代码。但当我提出请求时,我得到的回应是Javascript 获取twitter共享计数,响应给出奇怪的输出,javascript,html,twitter,Javascript,Html,Twitter,以上是我获取股票数量的代码。但当我提出请求时,我得到的回应是 //this function is the callback, it needs to be a global variable window.readResponse = function (response){ document.getElementsByTagName('SPAN')[0].innerHTML = response; } (functio
//this function is the callback, it needs to be a global variable
window.readResponse = function (response){
document.getElementsByTagName('SPAN')[0].innerHTML = response;
}
(function(){
//note the "readResponse" at the end
$URL = "http://www.google.com/"
var src = 'http://cdn.api.twitter.com/1/urls/count.json?url=' + $URL + '&callback=readResponse',
script = document.createElement('SCRIPT');
script.src = src;
document.body.appendChild(script);
})();
其中,正如我所期待的那样,response.count是实际的份额计数
我在这里设置了一个演示
如果Twitter有任何帮助,我们将不胜感激。对不起
function (){ //note the "readResponse" at the end $URL = "http://www.google.com/" var src = 'http://cdn.api.twitter.com/1/urls/count.json?url=' + $URL + '&callback=readResponse', script = document.createElement('SCRIPT'); script.src = src; document.body.appendChild(script); }