title: AJAX function to access PHP function in a PHP file
body: <p>I have a working AJAX file that will execute the content in a PHP file. However, if the php is within the function(there are alot of php funtion in a PHP file), how do I call only the function that I want.</p>
  
  <p>My AJAX code:</p>
  
  <pre><code>$(document).ready(function(){
  
  // use ajax, call the PHP
  $.ajax({
      url: 'postme.php', 
      success: function(response){
          $('.result_Postme').text(response);
      }
  })
  });
  </code></pre>
  
  <p>one of the function in postme.php PHP file:</p>
  
  <pre><code>&lt;?php 
    function echo()
    {
      echo 'Text';
    }
  ?&gt;
  </code></pre>
  
  <p>Thanks.</p>
  
  <p>EDIT:</p>
  
  <p>@Amadan hi, i tried ur method but it doesn't seems to be outputting in the html.</p>
  
  <p>My AjAx code:</p>
  
  <pre><code>$(document).ready(function(){
  
  // use ajax, call the PHP
  $.ajax({
      url: 'rank.php', 
      data: {
          action: 'echo'
      },
      success: function(response){
          $('.rank_Alibaba').text(response);
      }
  })
  });
  </code></pre>
  
  <p>PHP file</p>
  
  <pre><code>switch($_REQUEST['action']) 
  {
   case 'echo': 
   echo "text";
   break;
   }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code> &lt;td class="rank_Alibaba"&gt;&lt;/td&gt;
  </code></pre>