title: How to call a PHP function in an URL of ajax?
body: <p>I have written a PHP code having single function with an <strong>echo</strong> statement and I wish to call that function as a <strong>url</strong> in <strong>ajax</strong> code.
  I tired doing this.</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Writing PHP Function&lt;/title&gt;
  
          &lt;script&gt;
  
          $.ajax(
          {
          url : localhost/practice.php/f=myFirst();
          type: "GET",
          data: dataString,
  
          success: function(result)
          {
          alert(result);
          }
          });
  
          &lt;/script&gt;
  
      &lt;/head&gt;
  &lt;body&gt;
  
          &lt;?php
  
              function myFirst()
              { 
               echo 'The First ran successfully.'; 
              }
  
          ?&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>