I think the idea of a "wrapper.php"
is right. If you want to use it for many files you could do something like this, checking if it is an AJAX call to prevent direct load of the file:
// wrapper.php
<?php
// Check if it is AJAX
if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])
AND strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
$filename = $_GET['f'];
include 'includes/'.$filename.'.php';
}
And then:
$("#content").load("wrapper.php?f=login");
But be carefull with this, because it may be insecure.