title: javascript alert not working in ajax loaded content
body: <p>Couldnt really find any working solution to this problem. </p>
  
  <p>I have an alert in a a php page, that page is being loaded by AJAX. The alert doesnt work. Why?</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;script&gt;
              alert('test');
          &lt;/script&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;?php
              $from = $_REQUEST['from'];
              $to = $_REQUEST['to'];
              $amount_per_day = 100;
  
              $hoursDiff = ( strtotime($to) - strtotime($from) )/(60 * 60) / 24;
  
              $final_amount = $amount_per_day * ($hoursDiff + 1);
  
              if($final_amount &lt; 1900 &amp;&amp; $final_amount &gt; 0) {
                  echo $final_amount . ".00 GBP";
              }
              else if($final_amount &lt; 0) {
                  echo "Days cannot overlap";
              }
              else {
                  echo '0.00 GBP';
              }
          ?&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>