Thanks for adding some details, but I'm still slightly confused. I'll lay out an attempt (too long for a comment anyways).
You have some content that you want processed (into a file format?), but not until a browser event is triggered. Some clarification about ways to write modules for ExpressionEngine may help.
A module can return data in multiple ways. One way is to return tag data when the template engine calls your module. Another way is to use ACTion id's to return data via AJAX and/or GET/POST requests. A third way (not pertinent) is to import your module into other modules, or extract your logic into a library that can be included in different places in an addon.
You want to process some data presented in a template, but also want to use the same logic to be able to render some data on the fly on an already rendered template. Your module can do this with basically little modification.
So one way to get params to be processed is to get it selectively from the request context:
if (AJAX_REQUEST) {
// get from AJAX param
$my_param = ee()->input->get_post('my_param');
} else {
// get from template param
$my_param = ee()->TMPL->fetch_param('my_param');
}
From there, you simply proceed as you normally would with your module method's logic. When it comes time to return that information, you can do so, again, with the appropriate method based on request context:
if (AJAX_REQUEST) {
// return (make sure this is JSONified for ease of use)
ee()->output->send_ajax_response($this->return_data);
} else {
// return template tag data
return ee()->TMPL->parse_variables(ee()->TMPL->tagdata, array($this->return_data));
}
So with this methodology, you can use the same method to process and present information when the template is rendered but you can also use a jQuery AJAX request to that ACTion id (with the parameters as part of the request instead of as template params) to do the same thing.
If you don't need to reuse your logic, then this answer won't help you. If you simply need to asynchronously process data, just use jQuery and AJAX to hit a module method.
<script>
$(document).ready(function() {
$("#my_button").click(function() {
// get info from already rendered stuff
var my_param = $("#my_already_rendered_element").val();
$.get( '/?ACT=12345', {my_param:my_param}, function(data){
// dump returned dynamic info into an element
$('#my_dynamic_element').val(data.dynamic_return_var);
});
});
});
</script>
If this isn't helping, add another edit to your question that clearly maps out the data path you're seeking, as I may not be understanding you still.