# Link\_to\_remote question

**URL:** <https://www.ruby-forum.com/t/link-to-remote-question/173664>\
**Category:** Rails\
**Created:** [August 13, 2009, 12:18am UTC](https://www.ruby-forum.com/t/link-to-remote-question/173664 "2009-08-13T00:18:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hangingclowns](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b5e925/32.png) [@hangingclowns](https://www.ruby-forum.com/u/hangingclowns)\
**Post date:** [August 13, 2009, 12:18am UTC](https://www.ruby-forum.com/t/link-to-remote-question/173664/1 "2009-08-13T00:18:56Z")

</div>

I have the simple view page:

\<%= link\_to\_remote "Turn on Alert", :url =\> {:controller =\> "alerts", :action =\> "new"} :update =\> "test1" %\>

Then in my controller I simply do

if request.xhr?  
render :text =\> “AJAX Called”  
else  
redirect\_to :back  
end

It’s hitting the request.xhr? block as I had a logger.info statement  
there. However the “test1” div is not saying “AJAX Called”. Nothing  
appears.

Help?

---

<div class="post-metadata">

**Author:** ![hangingclowns](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b5e925/32.png) [@hangingclowns](https://www.ruby-forum.com/u/hangingclowns)\
**Post date:** [August 13, 2009, 1:31am UTC](https://www.ruby-forum.com/t/link-to-remote-question/173664/2 "2009-08-13T01:31:52Z")

</div>

One thing I forgot to add, I have a nested div actually b/c my layout  
has a div. So the above is really

Could this be the problem?

---

<div class="post-metadata">

**Author:** ![hangingclowns](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b5e925/32.png) [@hangingclowns](https://www.ruby-forum.com/u/hangingclowns)\
**Post date:** [August 13, 2009, 2:12am UTC](https://www.ruby-forum.com/t/link-to-remote-question/173664/3 "2009-08-13T02:12:56Z")

</div>

Found the problem:

You need to put

\<%= javascript\_include\_tag :defaults %\>

as the last javascript\_include\_tag in the layout
