Does load() prevent js code from being loaded?

Does load() prevent js code from being loaded?

I have some code like this:

  1. $("#loadit").on("click", function() {
  2.       load_it($("#loadit"), url);
  3.     });
  4.     
  5.     function load_it(el, url)
  6.     {           
  7.         var el_wf = $('<div />');
  8.         el_wf.load(url, function (html, status) {
  9.             el.children().remove();
  10.             el_wf.show();
  11.             el_wf.appendTo(el);
  12.         });             
  13.     }                   

In the url that is loaded I have some code like this:

  1.     <script type="text/javascript" src="/static/scripts/myscript.js"></script>
  2.          .
  3.          .
  4.          .
  5.     <div>
  6.        <script>
  7.           function_in_myscript();
  8.        </script>
  9.     </div>

When I click on the element in the first page, and the second page is loaded that js function is not invoked. There are no errors, and the rest of the page is generated fine.

But if I go to the second URL directly from my browser the js function is run.

Is there something with load() that is preventing this from working?