Web サイトの JSON、Twitter API、および Javascript に 1 つのツイートを表示しています。ツイートは私のホームページには表示されますが、サブページには表示されません。サブページで、JSON 呼び出しで 401 (未承認) エラーが発生します。これを修正する方法はありますか?これが私のスクリプトです:
(function($){
$.fn.tweets = function(options) {
$.ajaxSetup({ cache: true });
var defaults = {
tweets: 1,
before: "<span>",
after: "</span>"
};
var optionsWithDefaults = $.extend(defaults, options);
return this.each(function() {
var obj = $(this);
$.getJSON('http://api.twitter.com/1/statuses/user_timeline.json?callback=?&screen_name='+optionsWithDefaults.username+'&count=' + optionsWithDefaults.tweets,
function(data) {
$.each(data, function(i, tweet) {
if(tweet.text !== undefined) {
$(obj).append(optionsWithDefaults.before+tweet.text+optionsWithDefaults.after);
}
});
}
);
});
};
})(jQuery);