【发布时间】:2013-10-09 13:53:09
【问题描述】:
我将在我的网站上显示我最新的推文。在 tweet_json.php 上一切正常,但是当我将它们显示在我的网站上时,他给了我这个错误:
ReferenceError: listTweets 未定义
我不知道,为什么。有人可以帮帮我吗?
我的一段代码:
<script type="text/javascript" src="twitter/tweet_json.php?count=3&callback=listTweets"></script>
<script type="text/javascript">
$(document).ready(function(){
var refreshID = setInterval(function(){
$.getJSON('twitter/tweet_json.php?count=3', function(data) {
listTweets(data);
$('.twitterfeed').trigger('create');
});
}, 5000);
});
</script>
我正确复制/粘贴了我的 twitter 应用程序密钥。
非常感谢!
【问题讨论】:
-
listTweets() 是否在某处定义为 javascript 函数?我没有看到它,这就是您遇到的错误。
-
你在哪里定义
listTweets? :// -
我有两个文件。一个 tweet_json.php,没有定义像:listTweets() 之类的东西。在另一个文件 tmhOAuth.php 中,没有像 listTweets() 那样定义任何内容。 (github.com/themattharris/tmhoauth) 和 (gist.github.com/planetoftheweb/5914179)。
-
@tilldown 你修复了错误吗?我面临同样的问题..谢谢