Prerender AJAX


I've got several AJAX actions in my controller and another action,
that displays links that could trigger the AJAX calls. I'm trying to
implement the following:

1.) Usually if the user clicks the link on the page, the AJAX request
to the server is made, rails renders the result and sends the response
back to the client and the response is inserted into the page.

2.) I'd like to have a simple helper method
prerender '/someurl/to/some/controller/action/params/'
and when using it in the view of the primary action, the behaviour
should change. When the user clicks the link, no AJAX request is
triggerred, instead the client side script fetches the result from
some Javascript variable, like $.prerendered_ajax['/someurl/to/some/
controller/action/params'] and inserts that into the page.

This would allow me to fine tune the amount of static page content and
ajax calls to kinda balance bandwith and responsiveness.

In order for this to work of course, the server had to put in the
result of that AJAX action into the $.prerendered_ajax array. Question
is now:

How do I (with the least overhead and without restarting rails
entirely) get the result of the AJAX action inside my primary action
as a string (and giving the url). seems to
be my guy, but the env parameter has holds quite a few values when
debugging a normal AJAX call, and I'm not sure how to fill them.

Any help welcome!

T. Enderling