Pongamos un archivo ajax.js típico (copiado de este foro, sin ir más lejos):
    
Código Javascript
:
Ver originalfunction objetoAjax(){
    var xmlhttp=false;
    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
           xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (E) {
            xmlhttp = false;
          }
    }
 
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
        xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}
 
function GuardarRegistro(){
  //donde se mostrará lo resultados
  divResultado = document.getElementById('resultado');
  divResultado.innerHTML= '<img src="anim.gif">';
  //valores de las cajas de texto
  nombre=document.registro.nombre.value;
  email=document.registro.departamento.value;
  telefono=document.registro.telefono.value;
  celular=document.registro.celular.value;
 
//instanciamos el objetoAjax
 
    ajax=objetoAjax();
  //uso del medoto POST
  //archivo que realizará la operacion
  //registro.php
  ajax.open("POST", "add.php",true);
  ajax.onreadystatechange=function() {
  if (ajax.readyState==4) {
  //mostrar resultados en esta capa
  divResultado.innerHTML = ajax.responseText
  //llamar a funcion para limpiar los inputs
  LimpiarCampos();
  }
  }
 
  ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  //enviando los valores
  ajax.send("nombre="+nombre+"&email="+email+"&telefono="+telefono+"&celular="+celular)
}
 
function LimpiarCampos(){
  document.registro.nombre.value="";
  document.registro.departamento.value="";
  document.registro.telefono.value="";
  document.registro.celular.value="";
 
  document.registro.nombre.focus();
}
  
Tengo una duda en la línea: 
  ajax.open("POST", "add.php",true); 
¿Cómo puedo llamar directamente a una función incluida en ese archivo?
¿Le pongo un <?php require_once("add.php");?> arriba de todo, y en el open le pongo el nombre de la función?
¿O en el add.php le pongo un if isSet($_POST["enviar"])?