jquery - fetching and displaying images, data from external site using JSON? -
i want display them in html web page using json. current code below: beginner dont know json please me need display images in webpage :
$(document).ready(function() { var url = 'http://api.dribbble.com/shots/popular?jsoncallback=?'; var params = { format: 'json' }; $.getjson(url, params, function(json) { $.each( json.shots, function(i) { var item = json[i].shots[i]; $('<p> shots: ' + item.player[0].shots_count + 'enter code here'</p>') .append('<a href="' + item.avatar_url+ '"></a>') .append('<img src="' + item.avatar_url + '" />') .appendto('#photos'); return < 2; }); }); });
it looks attempting retrieve jsonp data remote site. visiting url in question, jsonp not returned. after reading the documentation, looks code work if use "http://api.dribbble.com/shots/popular?callback=?" remote url.
Comments
Post a Comment