javascript - How to reload and re-execute an ad network script? -


i'm posting first time after having read through many posts find seemed applicable. i'm amateur dev of found here on head. if have time , willingness @ problem i'd appreciate it.

i have image gallery layout on site. each time user views new image in gallery want re-execute/re-load ad code on page.

the ad code on page looks this:

<div class="slide-ads row" id="slide-ads-2" style='width: 300px; margin: 0px auto;'>   <div class="ad-tag" data-ad-name="rectangle2_newformat" data-ad-size="300x250" ></div>   <script src="//tags-cdn.deployads.com/a/mindpause.co.js" async ></script>   <script>(deployads = window.deployads || []).push({});</script> </div> 

on click update content , make call moveads function, causes ad code re-execute (and produce new ad impression) through jquery's detach , appendto functions. relevant code:

 $('.slide-next, .slide-start').on('click', function (e) {    $current = $(this).closest('article');     if ($current && $current.next().length > 0) {      moveads($current, $current.next());       $current.hide();      $current.next().show();    } });  function moveads($src, $dest) {   $ad2 = $src.find("#slide-ads-2");    $elem = $ad2.detach();   $elem.appendto($dest.find(".slide-content")); } 

at midnight est on may 6th approach stopped working, unexpectedly. detach , appendto functions stopped causing ad codes re-execute. haven't been able identify code change, wordpress update, or other change might have caused (nor has ad network themselves).

i have 2 core questions:

  1. are there obvious culprits might have caused approach work 1 day , break next (for ex: core jquery updates)? should looking attempt de-bug this?

  2. in single page framework in content updates without full page refreshes, fastest/most efficient way re-execute ad code scripts these? read thread wasn't sure if approach applicable use case:

should along lines of @kelly had answered here?


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

python 3.x - PyQt5 - Signal : pyqtSignal no method connect -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)