Reputation: 3255
So I'm really new to APIs, and I'm trying to use jQuery with this tutorial code I saw on the net today. I'm working in jsFiddle: http://jsfiddle.net/shrimpboyho/Pg5kG/
Here's the code:
alert("Using Flickr Api");
$.getJSON(
"http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?",
{
tags: "mount rainier",
tagmode: "any",
format: "json"
},
function(data) {
$.each(data.items, function(i,item){
$("<img/>").attr("src", item.media.m).appendTo("#images");
if (i == 3)
return false;
});
});
And here's the HTML:
<html>
<head> Flicker Api</head>
<div id= "content"></div>
<body></body>
</html>
Why is this not working?
Upvotes: 2
Views: 469
Reputation: 337701
Your HTML is invalid:
div
outside of the body
. Flicker Api
should be inside a <title>
tag. #images
, but the div is called #content
.Once you've sorted those issues, it should work:
Upvotes: 3