title: JavaScript from ajax modified file doesn't work in main page
body: <p>I have a problems with a form and ajax behavior when I populate my dynamic div using JavaScript.</p>
  
  <p>I have a drop box  which contains different time periods and it triggers JavaScript function which modifies the container div based on provided value.</p>
  
  <p>The problem is that the POST behavior of the form and all JavaScript elements doesn't work in the main file. </p>
  
  <p>Here is the code. I simplified it to emphasize the problem.
  this is the drop Box:</p>
  
  <pre><code>//jQuery for datePicker comes here
  
  &lt;select id="QSelector" method="post" onchange="populateDiv(this.value)"&gt;
     &lt;option value="0"&gt;All Values&lt;/option&gt;
     &lt;option value="1"&gt;Sets for 1&lt;/option&gt;
     &lt;option value="2"&gt;Sets for 2&lt;/option&gt;
     &lt;option value="3"&gt;Sets for 3&lt;/option&gt;
     &lt;option value="4"&gt;Sets for 4&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;div id="OUtputDiv" &gt;&lt;/div&gt;
  </code></pre>
  
  <p>here is the javascript function:</p>
  
  <pre><code>          function populateDiv(id){
            var xmlhttp;
            if(window.XMLHttpRequest){//safari, chrome, opera, ffox
               xmlhttp=new XMLHttpRequest();
            }
            else{//IE
               xmlhttp=ActiveXObject("Microft.XMLHTTP");
            }
  
            xmlhttp.onreadystatechange=function(){
            if(xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200){
               document.getElementById("OUtputDiv").innerHTML = xmlhttp.responseText;
             }
           }
           xmlhttp.open("GET", "../scripts/supportFile.php?ID=" + id, true);
           xmlhttp.send();
     }
  </code></pre>
  
  <p>And here is the content of the support file. don't mind the <code>id</code> variable it does some logic (ant it works), but I removed it because it's irrelevant to a given problem.</p>
  
  <pre><code>  &lt;?php
  
       $Id= $_GET['ID'];
        echo "&lt;script&gt; alert('it works'); &lt;/script&gt;";
        echo "&lt;form name='AddForm' class='AddForm' method='post' &gt;";
        echo "&lt;span &gt; Date: &amp;nbsp; &lt;/span&gt; &lt;input type='textbox' id='datepicker' name='datepicker' &gt; &amp;nbsp;";
        echo "&lt;input type='submit' name='SubBtn' value='Save' &gt;";
        echo "&lt;/form&gt;";
  
        if(isset($_POST['SubBtn']))
        {
            echo $_POST["datepicker"];
        }
     ?&gt;
  </code></pre>
  
  <p>Nether JavaScript or JQuery  does not work from the main file. And form does not post anything if I press the save button.
  Can anyone suggest how can I make it responsive in the main file where I call ajax function from?</p>