# AJAX/Javascript Question

**URL:** <https://www.ruby-forum.com/t/ajax-javascript-question/172408>\
**Category:** Rails\
**Created:** [July 21, 2009, 2:57am UTC](https://www.ruby-forum.com/t/ajax-javascript-question/172408 "2009-07-21T02:57:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeffrey\_LSTaylor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee7513/32.png) [@Jeffrey\_LSTaylor](https://www.ruby-forum.com/u/Jeffrey_LSTaylor)\
**Post date:** [July 21, 2009, 2:57am UTC](https://www.ruby-forum.com/t/ajax-javascript-question/172408/1 "2009-07-21T02:57:39Z")

</div>

What is the difference between these two:

render :js =\> "window.open(’#{url}’)

and

render :update do |page|  
page \<\< "window.open(’#{url}’)  
end

TIA,  
Jeffrey

---

<div class="post-metadata">

**Author:** ![Jeffrey\_LSTaylor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee7513/32.png) [@Jeffrey\_LSTaylor](https://www.ruby-forum.com/u/Jeffrey_LSTaylor)\
**Post date:** [July 21, 2009, 3:10am UTC](https://www.ruby-forum.com/t/ajax-javascript-question/172408/2 "2009-07-21T03:10:30Z")

</div>

Quoting Jeffrey L. Taylor [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> end
> 
> TIA,  
> Jeffrey

Actually, I am trying to update a element in a frame and open a new  
window wit  
a specific URL. The HTML is:

\<%=link\_to\_remote article.title,  
:url =\> {:controller =\> ‘three\_pane’, :action =\> ‘click’, :id =\>  
article},  
:complete =\> ‘eval(request.responseText)’ %\>

The render in the action is:

render :update do |page|  
page \<\< “window.open(‘#{article.url}’)”  
page \<\<  
“parent.feeds.document.getElementById(‘#{dom\_id(article.feed)}’).update(‘#{content}’);”  
end

The preceding code does the update AND opens two windows to article.url.  
The  
following code opens only one window, but doesn’t do the update.

render :js =\> “window.open(‘#{article.url}’)”

I don’t understand what’s going on.

TIA,  
Jeffrey
