title: Inserting a <script> tag dynamically via jQuery
body: <p>I'm trying to add a widget to the page in run-time. Based on <a href="https://stackoverflow.com/questions/3857874/how-to-dynamically-insert-a-script-tag-via-jquery-after-page-load">this post</a>, I wrote the code below. Unfortunately, it doesn't show anything. Can anybody tell me why?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          var s = document.createElement("script");
          s.type = "text/javascript";
          s.src = "https://widgets.factiva.com/syndication/subscriber/InsertWidget.ashx?tkn=LDyKkRh5SFskMPuGz6nika6Sg%2bqurZ4vspn0e1OvlEQc6JqLTdcyY8%2btC7a9zO0Z42ta%2f%2fl7QbCByRVbs7TTuQ%3d%3d%7c2&amp;typ=0&amp;st=1&amp;target=7";
          // Use any selector
          $(".testWidget").append(s);
      });
  &lt;/script&gt;
  
  &lt;div class="testWidget"&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>If I put the same script as below, it works and shows some information on the page. However, I should insert the script dynamically, not as static.</p>
  
  <pre><code>&lt;div class="testWidget"&gt;
  &lt;script src="https://widgets.factiva.com/syndication/subscriber/InsertWidget.ashx?tkn=LDyKkRh5SFskMPuGz6nika6Sg%2bqurZ4vspn0e1OvlEQc6JqLTdcyY8%2btC7a9zO0Z42ta%2f%2fl7QbCByRVbs7TTuQ%3d%3d%7c2&amp;typ=0&amp;st=1&amp;target=7" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
  &lt;/div&gt;
  </code></pre>