Note that there are some explanatory texts on larger screens.

plurals
  1. POCan only execute script one time
    text
    copied!<p>I'm using Ajax to load a page, and on that page I'm loading an external script from <code>issuu.com</code>. It works very nicely the first time either I or Ajax load the page, but if Ajax loads a new page and then goes back again it will not run the external script again (It loads the script, but doesn't execute it).</p> <p>This is the page: <a href="http://dymak-corporate.134.lait.dk/catalogue/" rel="nofollow">http://dymak-corporate.134.lait.dk/catalogue/</a></p> <p>You can see in e.g. the network tab of your browser's dev tools that it loads the script both times, but only executes the first time.</p> <p>I have tried to load and execute the script in every way I can think of and nothing is working.</p> <p>jQuery GetScript:</p> <pre><code> $.getScript("//e.issuu.com/embed.js") </code></pre> <p>Ajax load the script and eval it:</p> <pre><code>$.ajax({ url: "/scripts/embed.js", success: function (responseText) { eval(responseText); } }); </code></pre> <p>Adding it to the header every time and removing it before I add it:</p> <pre><code>$('#issuuScript').remove(); var s = document.createElement("script"); s.id = "issuuScript"; s.src = "//e.issuu.com/embed.js"; document.head.append(s); </code></pre> <p>Reloading it at every load:</p> <pre><code>function reload_js(src) { $('script[src="' + src + '"]').remove(); $('&lt;script&gt;').attr('src', src).appendTo('head'); } reload_js('/scripts/embed.js'); </code></pre> <p>I also tried adding it inline, without success.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload