Giving a response to an AJAX call is actually quite easy. The server receives a request, the server returns something. End.
Now, imagine you don't just want a response, you want to give a response that goes through all the ImpressCMS process, including the template engine. Permissions, Protector, Custom tags, Smarty, everything. A bit more difficult, but not too much.