I’ve just found the following from Jason in one of your links:
all public AJAX interaction should be done via Resources and Snippets for components outside of the mgr context. Adding new gateways for AJAX targets is unnecessary and will potentially lead to unintended security risks.
So that seems pretty clear!
What I am currently doing is:
Published page (e.g id=10), template="mainsite"
[tt]Hello, this is the calendar
[[+calendar]]
[/tt]
"Calendar" snippet:
Displays HTML with (wait for it

) the calendar!
But there are also buttons that use jQuery to open a dialog box which then makes an Ajax request for more detail on events. My dilemma is where to point this request.
So is the best way to create a 2nd "hidden" page (i.e. published but not linked into the main site) with a blank template, e.g. id = 11, and then change the main pages snippet call from:
[tt][[+calendar]] [/tt]
to
[tt][[+calendar? & ajaxRequestUrl=`11`]][/tt]
so it knows where to send the Ajax to? Ideally I’d like to package this for other people to use (if I ever get it working!) and it just seems like a certain amount of setup is going required by anyone installing it which I was hoping to avoid.
Or is there anyway for a snippet to override the template the page is going to use and if the snippet detects an Ajax request then force a blank template? That would be a lot neater...