Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jquery在一个json请求中获取facebook照片_Jquery_Html_Json_Facebook - Fatal编程技术网

使用jquery在一个json请求中获取facebook照片

使用jquery在一个json请求中获取facebook照片,jquery,html,json,facebook,Jquery,Html,Json,Facebook,好的,我在Facebook上有一个“页面”,还有它自己的网站。我想将所有照片从“页面”链接到网站,这样我就可以有一个图库进行编辑。我知道如何接收一个图像,但我不知道如何接收多个图像,然后将其显示在新的div中?我在谷歌上搜索了!#但还是什么都没想到。。提前感谢:D var fburl_photo = "http://graph.facebook.com/868.Rotary.Northstar.RCACS/albums?fields=photos"; $.getJSON(fburl_photo,

好的,我在Facebook上有一个“页面”,还有它自己的网站。我想将所有照片从“页面”链接到网站,这样我就可以有一个图库进行编辑。我知道如何接收一个图像,但我不知道如何接收多个图像,然后将其显示在新的div中?我在谷歌上搜索了!#但还是什么都没想到。。提前感谢:D

var fburl_photo = "http://graph.facebook.com/868.Rotary.Northstar.RCACS/albums?fields=photos";
$.getJSON(fburl_photo,function(data){
    var albums = data["picture"];
    $("#albums").append("<div>" + albums + "</div>");
});
var fburl\u photo=”http://graph.facebook.com/868.Rotary.Northstar.RCACS/albums?fields=photos";
$.getJSON(fburl\u照片,函数(数据){
var albums=数据[“图片”];
$(“#相册”)。追加(“+相册+”);
});

这应该让您开始学习。如果有什么不清楚的,请告诉我

var url = 'http://graph.facebook.com/';
url += '868.Rotary.Northstar.RCACS/albums?fields=photos'; 
//to save some space here

$(function(){

    $.ajax({
        url: url,
        dataType: 'jsonp',
        success: function(data){

            $.each(data.data, function(k1, album){

                if(k1 > 1) //just showing the first 2lists for demo purpose
                    return true; //skipping the rest

                var pictureArray = album.photos.data;
                //get an array of photos                    

                $.each(pictureArray, function(k2, pictureObject){

                //pictureObject.picture contains the image url

                //create a new image tag and append it to the body

                    var $img = $('<img/>')
                                   .prop({ src: pictureObject.picture })
                                   .wrap('<a href="#anchor"></a>')
                                   .appendTo('body');

                });

            });

        }
    });

});
var url='1〕http://graph.facebook.com/';

url+=“868.Rotary.Northstar.RCACS/相册?字段=照片”; //在这里节省一些空间 $(函数(){ $.ajax({ url:url, 数据类型:“jsonp”, 成功:功能(数据){ $.each(data.data,函数(k1,相册){ if(k1>1)//仅显示前2个列表用于演示 返回true;//跳过其余部分 var picturarray=album.photos.data; //获取一组照片 $.each(pictureArray,函数(k2,pictureObject){ //pictureObject.picture包含图像url //创建新的图像标记并将其附加到主体 变量$img=$('
示例:

现在,如果我想在每个img上添加一个锚定到它的源上……我将如何附加它?@CantFindIt在这里查看url+='868.Rotary.Northstar.RCACS/albums?fields=photos';?这是什么我不明白。我可以使用这种类型的url+='me/albums?fields=photos'@TrilokGupta它只是将字符串合并在一起