title: execute inline js loaded via ajax
body: <p>hi and thanks for stopping.</p>
  
  <p>i already solved my problem, but on my own, so i just want to share my solution and maybe someone has a more elegant way to solve it. maybe its just nice as it is.</p>
  
  <p>so im loading some html via jquery.ajax() and the dataType is html.
  sometimes a video is placed inside, and the most elegant way for me to embed this, is the jwplayers js embed code, that looks like this:</p>
  
  <pre><code>&lt;script&gt;
      jwplayer("mediaplayer").setup({
          flashplayer: "/player.swf",
          image: "/image.jpg",
          autostart: true,
          'controlbar': 'none',
          file: "/video.m4v",
          width: 752,
          height: 416
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>now if i load this, nothing happens, the js just doesnt get executed.</p>
  
  <p>so i ended up putting the js WITHOUT the script tags into a div.</p>
  
  <pre><code>&lt;div id="vc"&gt;
      jwplayer("mediaplayer").setup({
          ...
      });
  &lt;/div&gt;
  </code></pre>
  
  <p>and then in my ajaxComplete() call i simply move the stuff out of the div and place it in between two script tags.</p>
  
  <pre><code>if ($("#vc").text() !== "") {
      var vjs = $("#vc").text();
      $("#vc").empty().html("&lt;script&gt;"+vjs+"&lt;/script&gt;");
  }
  </code></pre>