jQuery Load不在页面内部实现脚本

I have a popup that reload the content after a click. I usa jQuery .load to reload the content. Code in short:

var posting = $.post(url, $form.serialize());
posting.done(function(data) {    
   $('.modal-body .content').load(window.location.href + " .modal-body .content"),
}

In this way I can refresh only the popup content with the new data. But the popup have also a script, this script is not load.

This script is inside a PHP because I need to populate it.

<?php
    foreach ($items as $p){
        var $myVar = array(...)
    }


echo '
  <script>
     ...
     '. $myVar .'
     ...
  </script>';

?>

Now, how can I load this script inside the popup? I can not load a external js file because I need the PHP variable. I can't use .load. I try to use a Ajax but I'am not sure how I can do.