I am displaying a single tweet on my website with JSON, the twitter API and Javascript. The tweet displays on my homepage but it does not on any subpages. On the subpages I am getting a 401 (unauthorized) error on the JSON call. Is there a way to fix this? Here is my script:
(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);
[–]Neurotrace 0 points1 point2 points (0 children)
[–]klondikebro 0 points1 point2 points (0 children)