title: Getting response from Using dataType script with jQuery on ajax request
body: <p>Not sure if this should work but from a jquery ajax request with the response I want to evaluate the script being passed back. Here goes for an example.</p>
  
  <pre><code>$.ajax({
      url: some/path,
      dataType: 'script'
  });
  </code></pre>
  
  <p>Then with my response I'm using php to spit out the javascript.</p>
  
  <pre><code>&lt;?php
  header("content-type: application/javascript");
  
  $str = &lt;&lt;&lt;EOF
      alert('help');
  EOF;
  echo $str;
  </code></pre>
  
  <p>If I'm correct I should get a alert pop-up after performing the request.</p>
  
  <p>I can see from the response headers it correct:</p>
  
  <pre><code>Accept:application/json, text/javascript, */*; q=0.01 
  </code></pre>
  
  <p>And response is:</p>
  
  <pre><code>alert('help');
  </code></pre>
  
  <p>But no alert box is being triggered. Am I missing something or can this not be done this way?</p>
  
  <p>Hope you can advise.</p>
  
  <p>TY</p>