I’m trying to bind $('#pics').click(function()){ to activate the following basic JSONP request:
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",
function(data){
$.each(data.items, function(i,item){
$("<img/>").attr("src", item.media.m).appendTo("#images");
if ( i == 3 ) return false;
});
});
});
HTML:
<body>
<button name="pics" id="pics">Pics</button>
<div id="images">
</div>
The idea is to have a page with different buttons and requests, but I can’t get the button to perform the function.
Try this :