Server-side rpc.php

<?php
include './db.inc';
include 
'./db_people.inc';
include 
'./db_languages.inc';

$people = new people;
$action $_REQUEST['action'];

switch(
$action) {
  case 
'markers':
    
header("Content-type: application/json");
    
$all $people->load();
    echo 
json_encode(array('people'=>$all));
    break;

  case 
'lang':
    
header("Content-type: text/javascript");
    
$languages = new languages;
    
$found $languages->search($q);
    foreach(
$found as $v) echo $v['name'].",";
    break;
}
?>