title: Execute javascript in a file called through post request
body: <p>I have a php file(<em>index.php</em>) that contains a button, wherein if that button is clicked, it will trigger a javascript function that will post request on a php file(<em>login.php</em>). Now on that login.php if a condition is true, I will be redirected to a url, using javascript. For this example, I will not ask how to redirect but just to perform a simple <code>alert()</code> on that login.php;</p>
  
  <p>I found an answer saying I should so this:</p>
  
  <pre><code>&lt;?php // some php code
     // php condition is true {
     echo "&lt;script type="text/javascript"&gt;
              alert('Alert worked.');
           &lt;/script&gt;";
     // }
     // more php code 
  ?&gt;
  </code></pre>
  
  <p>It performs the <code>echo</code> but never executes the script.<br>
  <strong>How could I execute javascript in a file(that is called through post request).</strong></p>