$(document).ready(function() { $('#instagram_more').bind('click', function() { getInstagramList($(this).attr('data-count')); }); $('.inst').bind('click', function() { showInstagramDetail($(this).attr('id')); }); }); function getInstagramList(count) { var fqdn = location.host; $.ajax({ type: 'GET', // url: 'http://taketomi.diocms.com/index.php?module=WebAPI&action=InstagramDataGet', url: 'http://'+fqdn+'/index.php?module=WebAPI&action=InstagramDataGet', data: { count: count }, dataType: 'json', cache: false, success: function(data) { // Output data $.each(data.images, function(i, d) { if (d.id) { $('#images').append('
'); } }); if (data.count >= 100) { $('#instagram_more').remove(); } else { $('#instagram_more').attr('data-count', data.count); } $(".inst").bind("click", function(){ showInstagramDetail($(this).attr('id')); }); } }); } function showInstagramDetail(id) { var fqdn = location.host; $.ajax({ type: 'GET', // url: 'http://taketomi.diocms.com/index.php?module=WebAPI&action=InstagramDetailDataGet', url: 'http://'+location.host+'/index.php?module=WebAPI&action=InstagramDetailDataGet', data: { id: id }, dataType: 'json', cache: false, success: function(d) { $('').on('click', function() { layer_hide(); }).appendTo('body').fadeIn(); // Output data var commens = []; if(d.comment_count){ $.each(d.comments, function(key, val) { commens.push('