title: using ajax url to call function
body: <p>Hopefully I can ask this correctly cuz I know what I want it to do but can't seem to find any answers from searching.</p>
  
  <p>I have a func.php page where I have all my functions and I want ajax to use one function from that page.</p>
  
  <p>func.php</p>
  
  <pre><code>function toptable()
  { 
    echo"something happens in here";
  }
  </code></pre>
  
  <p>index.php</p>
  
  <pre><code>&lt;?php include 'func.php'; ?&gt;
  &lt;script type="text/javascript"&gt;
  function check_username() {
    uname=document.getElementById("username").value;
    var params = "user_id="+uname;
    var url = "topoftable()";
    $.ajax({
        type: 'POST',
        url: url,
        dataType: 'html',
        data: params,
        beforeSend: function() {
          document.getElementById("right").innerHTML= 'checking'  ;
        },
        complete: function() {
  
        },
        success: function(html) {
          document.getElementById("right").innerHTML= html ;
        }
    });
  
  }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Make sense?</p>