Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just looking at your variable <code>$x</code>, here's my suggestions.</p> <pre><code> $id = $this-&gt;db-&gt;insert_id(); $rootURL = $this-&gt;config-&gt;item('url'); $x = &lt;&lt;&lt;EOD &lt;style&gt; #codeBox { cursor: auto; min-width: 643px; min-height: 112px; max-width: 643px; max-height: 112px; margin-left: 5px; } &lt;/style&gt; &lt;input type="hidden" value="$id" name="hdn" id="hdn" /&gt; &lt;textarea id="codebox" readonly&gt; &lt;div id="myads{$id}"&gt;&lt;/div&gt; &lt;/textarea&gt; &lt;script src="{$rootURL}allJs/myJs.js"&lt;/script&gt; EOD; echo $x; </code></pre> <p>Double check me on <code>id="myads{$id}</code>. Your code would have produced <code>id="myads"1</code>, not <code>id="myads1"</code>, as I believe you wanted.</p> <p>I mainly improved style, and moved the <code>&lt;script ...&gt;</code> outside of the <code>&lt;textarea&gt;</code>.</p> <pre><code>document.getElementById('codeBox').appendChild(JavaScriptCode); </code></pre> <p>In <code>myJs.js</code>, you are adding the element as a child to <code>&lt;div id="myads"&gt;</code>, so it would look like<br> <code>&lt;div id="myads"&gt;&lt;script&gt;&lt;/script&gt;&lt;/div&gt;</code>, not<br> <code>&lt;div&gt;&lt;/div&gt;&lt;script&gt;&lt;/script&gt;</code>.</p> <p>Instead, I've changed it to add the element to <code>&lt;div id="codebox"&gt;</code>.</p> <p>I also would suggest that, if you are hardcoding the contents of <code>&lt;div id="codebox"&gt;</code>, that you modify <code>$x</code> with the changes below, as you don't need Javascript to insert the <code>&lt;script&gt;</code>.</p> <pre><code>&lt;textarea id="codebox" readonly&gt; &lt;div id="myads{$id}"&gt;&lt;/div&gt; &lt;script async type='text/JavaScript' charset='utf-8' src='http://myDomain.com/content/{$id}'&gt;&lt;/script&gt; &lt;/textarea&gt; </code></pre> <p>Let me know if you still have problems.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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