# How to render a template in a popup window from a controller action?

**URL:** <https://www.ruby-forum.com/t/how-to-render-a-template-in-a-popup-window-from-a-controller-action/144285>\
**Category:** Rails\
**Created:** [July 28, 2008, 8:39am UTC](https://www.ruby-forum.com/t/how-to-render-a-template-in-a-popup-window-from-a-controller-action/144285 "2008-07-28T08:39:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![athem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/22d042/32.png) [@athem](https://www.ruby-forum.com/u/athem)\
**Post date:** [July 28, 2008, 8:39am UTC](https://www.ruby-forum.com/t/how-to-render-a-template-in-a-popup-window-from-a-controller-action/144285/1 "2008-07-28T08:39:09Z")

</div>

I’m trying to render a template in a popup window from a controller  
action. it would be equivalent to:

\<%= link\_to ‘Manage Documents and Photos’, { :action =\>  
‘manage\_photos\_documents\_popup’ }, :popup =\> [ ‘Manage Photos and  
Documents’, ‘width=550, height=600’ ] %\>

except instead of opening the popup when the user clicks on a link, it  
would happen in response to a statement in a controller.

I tried using an xhr request with something like:

render :update do | page |  
page \<\< “window.open(this.href,‘Manage Photos and  
Documents’,‘width=550, height=600’);return false;”  
end

but with no result.

Any suggestions for how to do this?

Thanks.
