I'm not entirely sure what you're doing but this might help. http://tapestry-stitch.uklance.cloudbees.net/capturedemo
As you can see, I render a block in an AJAX action and call alert(...). You could do anything you like with the rendered markup. Note: I hate rendering dom in javascript and always prefer rendering my markup serverside. I'm bucking the trend a bit here.