title: PHP function doesn't work with Ajax
body: <p>I have some button and on click JS for it:</p>
  
  <pre><code>&lt;button id="trigger"&gt;Send&lt;/button&gt;
  </code></pre>
  
  <p>and JS to invoke simple action</p>
  
  <pre><code>$('#trigger').on("click", function(event){ 
                      jQuery.ajax({
                          type: "POST",
                          url: 'functions.php',
                          dataType: 'json',
                          data: {functionname: 'add', arguments: [1, 2]},
  
                          success: function (obj, textstatus) {
                              alert('test success');
                          },
                          complete: function (obj, textstatus) {
                              alert('test complete');
                          }
                      });
                  });
  </code></pre>
  
  <p>In above ajax I put functions.php with other simple function:</p>
  
  <pre><code>&lt;?php
  
  $message = "PHP Funtion Alert";
  echo "&lt;script type='text/javascript'&gt;alert('$message');&lt;/script&gt;";
  
  ?&gt;
  </code></pre>
  
  <p>But, I got only alert invoked from alert('test complete');
  How invoke alert from PHP file?</p>
  
  <p>PS. this is only example. In PHP file will be some DB functions.</p>