title: How can I make a modal window (colorbox) load javascript (and not just the html)?
body: <p>I have POST button which loads a colorbox modal window, using this code:</p>
  
  <pre><code>&lt;link rel="stylesheet" href="colorbox2.css" /&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="jquery.colorbox.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  
  
      $(document).ready(function(){
      $(".cboxFormButton").click(function(e){
      e.preventDefault();
      var $form = $(this).closest('form');
      $.colorbox({
        href: $form.attr('action'),
        transition:"elastic",
        opacity:0.5,
        data: {
                  a: $form.find('input[name="a"]').val(),
                  b: $form.find('input[name="b"]').val()
                  }
          });
  
          return false;
      });
  });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  
  &lt;form action="rrr2.php" method="POST" target="_blank" class=""&gt;
      &lt;input  name="a" type="hidden" value="2"/&gt;
       &lt;input  name="b" type="hidden" value="2"/&gt;
      &lt;input type="submit" class="button cboxFormButton" value="Test"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I would need to insert a javascript tracking snippet into rrr2.php, so anytime that button was clicked, it would be tracked. So I've decided to test whether javascript in general would function if loaded from that window, and simply put just for testing, another colorbox code in the rrr2.php file (same code as above more or less), but it doesn't work.
  seems like only the html is processed.</p>
  
  <p>Why does it happen, and how can I overcome this?</p>
  
  <p><strong>EDIT:</strong> is this suppose to make it work?</p>
  
  <pre><code>&lt;script&gt;
  
  
      $(document).ready(function(){
      $(".cboxFormButton").click(function(e){
      e.preventDefault();
      var $form = $(this).closest('form');
      $.colorbox({
        href: $form.attr('action'),
        transition:"elastic",
        opacity:0.5,
        data: {
                  a: $form.find('input[name="a"]').val(),
                  b: $form.find('input[name="b"]').val()
                  }
          });
  
      $.get('rrr2.php');
  
          return false;
      });
  });
  &lt;/script&gt;
  </code></pre>