$(function() { getMedia('samphorsc'); function getMedia(username) { $('.loading').show(); $.ajax({ url: 'https://api.pinterest.com/v3/pidgets/users/'+username+'/pins', dataType: 'jsonp', type: 'GET', success: function(data) { $('ul.grid').empty(); var img = ''; var html = ''; for( x in data.data.pins ){ if ($.isNumeric(x)) { $.each( data.data.pins[x].images, function( key, value ) { img = value.url; }); html += '<li>'; html += '<img class="media-Instagram" src="'+img+'"/>'; // img.replace('237x', '564x') html += '</li>'; } } $('ul.grid').append(html); }, error: function(data){ console.log(data); } }); } })
<ul class="grid"> </ul>
ul.grid li { display : inline; } li img { width: 120px; height: 120px; }