Leer tus imagenes de un servicio de flickr. usando Jquery

Leer tus imagenes de un servicio de flickr. usando Jquery


$.getJSON("Url Service", function(json) {
jJSON["media"] = (function() {
response = {
values: [],
count: 0
};
$.each(json.items,function(i,item) {
if (item.media.m != "undefined") {
response.count++;
response.values[i] = item.media.m;
}
});
return response;
})();

jJSON["title"] = (function() {
response = {
values: [],
count: 0
};
$.each(json.items,function(i,item) {
if (item.title != "undefined") {
response.count++;
response.values[i] = item.title;
}
});
return response;
})();

var jJSON = {
getValues: function(obj,num) {
return jJSON[obj]["values"].slice(0,((num == null) ? jJSON[obj]["values"].length : num));
},
getCount: function(obj) {
return jJSON[obj]["count"];
},
getRandomValues: function(obj,num) {
var a = [];
var b = jJSON[obj]["values"];
var c = b.length;
if (num != null && num < c) {
c = num;
}
for (i = 0; i < c; i++) {
var e = Math.floor(Math.random() * b.length);
a[i] = b[e];
b.splice(e,1);
}
return a;
}
};

Comentarios

Entradas populares