$(window).on("load", function () { $.when( $(".advertisement").each(function () { const frame_hash = $(this).attr("class").split(" ")[1].replace("sid_", ""); $(this).load("https://aads.ascii.jp/ads/" + frame_hash + "/"); }) ).done(setTimeout(function () { $(".adsview").each(function () { const ad_hash = $(this).attr("class").split(" ")[1]; $(".advertisement").append(""); $(".advertisement link").load("https://aads.ascii.jp/adsview/" + ad_hash); $(".advertisement link").remove(); }); }, 200)); }); $(document).on("click", "#adscnt", function () { const ad_hash = $(this).attr("class").split(" ")[1]; $(this).load("https://aads.ascii.jp/adscnt/" + ad_hash); $(".advertisement").each(function () { const frame_hash = $(this).attr("class").split(" ")[1].replace("sid_", ""); $(this).load("https://aads.ascii.jp/ads/" + frame_hash + "/"); }); });