Jquery 通过不包含已知用户的标签显示instagram图片
我正在开发一个phonegap应用程序。我正在使用下一个HTML代码使用jQuery显示带有标签#beavercreek的instagram图片Jquery 通过不包含已知用户的标签显示instagram图片,jquery,cordova,feed,instagram,Jquery,Cordova,Feed,Instagram,我正在开发一个phonegap应用程序。我正在使用下一个HTML代码使用jQuery显示带有标签#beavercreek的instagram图片 <html> <head> <title>Instagram test</title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" /> <sc
<html>
<head>
<title>Instagram test</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head>
<body>
<script src="instagramfeed.js"></script>
<div class="instagramfeed"></div>
</body>
</html>
Instagram测试
此外,这是instagramfeed.js存档的代码
$(function() {
$.ajax({
type: "GET",
dataType: "jsonp",
cache: false,
url: "https://api.instagram.com/v1/tags/beavercreek/media/recent/?access_token=ACCESS_TOKEN_NUMBER",
success: function(data) {
console.log(data);
for (var i = 0; i < 15; i++) {
var date = new Date(parseInt(data.data[i].created_time) * 1000);
$(".instagramfeed").append("\
<img src='" + data.data[i].images.standard_resolution.url +"' />\
<div>"+date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear()+"</div>\
<div><strong>"+data.data[i].user.username+"</strong> "+data.data[i].caption.text+"</div><br /><br />\
");
date = null;
}
}
});
});
$(函数(){
$.ajax({
键入:“获取”,
数据类型:“jsonp”,
cache:false,
url:“https://api.instagram.com/v1/tags/beavercreek/media/recent/?access_token=ACCESS_TOKEN_NUMBER",
成功:功能(数据){
控制台日志(数据);
对于(变量i=0;i<15;i++){
变量日期=新日期(parseInt(data.data[i].创建时间)*1000);
$(“.instagramfeed”).append(”\
\
“+date.getDate()+”/“+(date.getMonth()+1)+”/“+date.getFullYear()+”\
“+data.data[i].user.username+”“+data.data[i].caption.text+”
\
");
日期=空;
}
}
});
});
我希望结果显示带有此标签(beavercreek)的instagram图片,但不包括已知用户名中的图片。有人能帮我吗
非常感谢。如果您可以接收相同的响应,但只是在代码中对其进行过滤,那么您可能可以这样做
for (var i = 0; i < 15; i++) {
if(data.data[i].user.username != YOUR_USERNAME) {
var date = new Date(parseInt(data.data[i].created_time) * 1000);
$(".instagramfeed").append("\
<img src='" + data.data[i].images.standard_resolution.url +"' />\
<div>"+date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear()+"</div>\
<div><strong>"+data.data[i].user.username+"</strong> "+data.data[i].caption.text+"</div><br /><br />\
");
date = null;
}
}
for(变量i=0;i<15;i++){
if(data.data[i].user.username!=您的_用户名){
变量日期=新日期(parseInt(data.data[i].创建时间)*1000);
$(“.instagramfeed”).append(”\
\
“+date.getDate()+”/“+(date.getMonth()+1)+”/“+date.getFullYear()+”\
“+data.data[i].user.username+”“+data.data[i].caption.text+”
\
");
日期=空;
}
}
您确定这是JAVA代码吗?对不起,是AJAX。谢谢你,很有效!但是我将if(data.data[I].user.username!=您的用户名)替换为if(data.data[I].user.id!=用户id)非常感谢。很高兴听到这个消息。如果你对答案感到满意,你介意投赞成票并将你的帖子标记为已回答吗?谢谢,我不能投你的票,因为我没有声誉。我已将你的答案标记为已接受,但我不知道如何将我的帖子标记为已回答。我怎么做?。干杯