我有以下脚本:这个jQuery脱机工作,但不能上网
<script type="text/javascript">
$.getJSON("http://api.twitter.com/1/statuses/user_timeline/koawatea.json?count=1&include_rts=1&callback=?", function(data)
{
$("#headertweet").html(data[0].text);
});
</script>
它已经创建了一个测试文档离线工作。 但是,当我将它放在线上时(实时或在本地XAMPP设置中),这不起作用。
有人可以告诉我为什么,请吗?
这里的CSS:
#headertwitterbox {
width: 200px;
height: 100px;
background:url(http://i48.tinypic.com/169ruab.jpg) no-repeat;
font-family: 'Source Sans Pro', sans-serif;
font-size: 7pt;
}
#headertweet {
width: 180px;
height: 53px;
float:left;
margin-left: 10px;
margin-top: 6px;
}
HTML:
<div id="headertwitterbox" style="float:left;">
<div id="headertweet"></div>
</div>
你有错吗?你也应该看看api的1.1版本。 – epascarello
我没有错误。 = S – Josh
[这是一个JSFiddle链接](http://jsfiddle.net/6SMnz/1/)。它在那里工作得很好。你使用的是一个有趣的jQuery版本吗? –