Reputation: 232
I can get the id and date but not the photo itself from tumblr json api :(
$.getJSON("http://fuckyeahgirlswithvinylrecords.tumblr.com/api/read/json?callback=?", function (data) {
$.each(data.posts, function (index, item) {
$("<div>").html(item.id).appendTo("#content");
$("<div>").html(item.date).appendTo("#content");
$("<img>").attr("src", item.photo-url-100).appendTo("#content");
});
});
Upvotes: 0
Views: 255
Reputation: 11671
Call it as follows,
$.getJSON("http://fuckyeahgirlswithvinylrecords.tumblr.com/api/read/json?callback=?", function (data) {
$.each(data.posts, function (index, item) {
$("<div>").html(item.id).appendTo("#content");
$("<div>").html(item.date).appendTo("#content");
$("<img>").attr("src", item['photo-url-100']).appendTo("#content");
});
});
Upvotes: 1
Reputation: 27012
Properties can't have dashes in them. Use bracket notation:
$("<img>").attr("src", item['photo-url-100']).appendTo("#content");
Upvotes: 3