title: Run javascript after AJAX is finished
body: <p>I am using an ajax call to load mycontent.php into my modal dialog box. I am using AJAX, but the 3 javascript tags are not being included or being executed in the mycontent.php when it is in the modal window. </p>
  
  <p>I have tried the eval statement but doesn't seem to work.</p>
  
  <p>Here is my code:</p>
  
  <p>main.html</p>
  
  <pre><code> &lt;a class="dialog" title="testvideo" href="mycontent.php"&gt;
   &lt;img class="imageleft" width="200" height="150" src="assets/images/photos/deya/thumbnail.jpg"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>modal.js</p>
  
  <pre><code>    $(document).ready(function() {                
  
         $('a.dialog').click(function (event) {
            if ($("body").hasClass("res-full")){
               event.preventDefault();
               $this = $(this);
  
               var URL     = $(this).attr('href');
               var dialogbox = document.getElementById('dialog');
               var dialogOptions = {
                          height: 'auto',
                          width: 'auto',
                          modal: true,
  
                //         open: function(event, ui){
  
                //         },
  
                         close: function(event, ui){
                              $('#dialog').empty(); 
                         }
            };
  
         if(dialogbox==null) {
            $this.after("&lt;div id=\"dialog\"&gt;&lt;/div&gt;");
         }
  
         jQuery('#dialog').load(URL + " #content", function() {eval($('script').html())}).dialog(dialogOptions);
  
  
        }            
        });
  
  
      });
  </code></pre>
  
  <p>mycontent.php</p>
  
  <pre><code>   &lt;div id="content"&gt;
         &lt;div id="VidPlayerPlaceholder_7001_wrapper"&gt;
          &lt;object id="VidPlayerPlaceholder_7001" width="100%" height="100%" type="application/x-shockwave-flash" data="video/player/player6.swf" bgcolor="#000000" name="VidPlayerPlaceholder_7001" tabindex="0"&gt;
          &lt;div id="VidPlayerPlaceholder_7001_jwpsrv" style="position: absolute; top: 0px; z-index: 10;"&gt;&lt;/div&gt;
     &lt;/div&gt;
     &lt;script type="text/javascript" src="http://www.mycompany.com/video/player/js/jwplayerv6.js"&gt;&lt;/script&gt;
     &lt;script type="text/javascript"&gt;jwplayer.key="jCz8k6TcT9i6M5vRXEI474+6dfNf9a7gHBbRfA==";&lt;/script&gt;
     &lt;script type="text/javascript"&gt;
            jwplayer('VidPlayerPlaceholder_4029').setup({ 
                      flashplayer: "http://www.company.com/video/player/player6.swf",
                      html5player: "http://www.company.com/video/player/js/jwplayer.html5.js",
                      playlist: [
              { image: "http://pciture.jpg", file: "rtmp://DEYA/video3.m4v"}
          ],
          width: '505',
          height: '430',
          stretch: 'uniform',
          autostart: 'false',
          repeat: 'false',
  
          logo: {
              file: 'http://ccopyright.png',
              link: 'http://www.mycompany.ca',
              hide: '',
              position: 'top-left'
          },
          rtmp: {
              bufferlength: '5'
          },
          primary: 'html5'
          });
          jwplayer('VidPlayerPlaceholder_4029').setVolume(50);
          if(0 &gt; 0){
              jwplayer('VidPlayerPlaceholder_4029').stop();       
              jwplayer('VidPlayerPlaceholder_4029').seek(0);      
              if('false' == 'false'){
                  jwplayer('VidPlayerPlaceholder_4029').pause();
              }
      }
  &lt;/script&gt; 
  </code></pre>
  
  <p>If anyone could help, that would be appreciated.</p>