What is error message?
If you want to use Ditto for ajax, you can create snippet like below:
<?php
.
.
$startID = $modx->db->escape($_GET['startID']);
$sortDir = $modx->db->escape($_GET['sortDir']);
.
include( Ditto snippet );
?>
put this snippet in a
blank document. now you can request data from this document and get response.
in this case, xmlResponseText will be Ditto output. you can do same with getting &format=xml in your ajax query for get XML response.
also you can get simple data without Ditto, by doing it yourself!