简体   繁体   English

使用Twitter API显示用户个人资料图片-jQuery

[英]Display user profile image with Twitter API - jQuery

I am using the Twitter API with jQuery to display a Twitter stream on my website. 我正在将Twitter API与jQuery结合使用,以在我的网站上显示Twitter流。 I would like to display the profile image, the tweet text and the time. 我想显示个人资料图片,推文和时间。 I have everything working except for the image. 除了图像,我一切正常。 Here is my script: 这是我的脚本:

        jQuery.getJSON('https://api.twitter.com/1/statuses/user_timeline/twitterapi.json?count=3&include_entities=true&include_rts=1&callback=?', function(data){
            jQuery.each(data, function(index, item){
                jQuery('.twitter').append('<div class="tweet"><p>' + item.text.linkify() + '</p><p><strong>' + relative_time(item.created_at) + '</strong></p></div>');
            });

        });

I tried to add item.profile_image_url but nothing shows up. 我尝试添加item.profile_image_url,但未显示任何内容。

用户变量中的profile_image_url变量

item.user.profile_image_url

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM