I think what you are looking for is an "XAGent" that will output html to the browser after an event.
On your button add the code to the onClick event to load the target XAgent
context.redirectToPage("HTMLXPage.xsp");
On the target XPage, set it's render property to false, and in the afterRenderResponse event add the following code. Where I have the Hello World output you can compute whatever output you want.
var extCont = facesContext.getExternalContext();
// The Faces Context Response Writer is similar to the Lotuscript print statement
// and the Java printwriter object to produce output to the browser.
// There is also a getResposneStream() for producing binary output.
var pageOutput = facesContext.getResponseWriter();
// The servlet's response object provides control to the response object.
var pageResponse = extCont.getResponse();
// The content type has to be set to the output MIME type. In this case HTML.
pageResponse.setContentType("text/html");
// Additional methods of the response object can be set. The following keeps the content from being cached.
pageResponse.setHeader("Cache-Control", "no-cache");
// Use the writer object to produce all of the output. The following is a simple HTML Page.
pageOutput.write("<h1>Hello World</h1>");
// End and close the writer object.
pageOutput.endDocument();
// Terminate the request processing lifecycle.
facesContext.responseComplete();