# Login redirect on ajax call?

**URL:** <https://www.ruby-forum.com/t/login-redirect-on-ajax-call/106161>\
**Category:** Rails\
**Created:** [June 6, 2007, 11:17pm UTC](https://www.ruby-forum.com/t/login-redirect-on-ajax-call/106161 "2007-06-06T23:17:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mark](https://www.ruby-forum.com/u/mark)\
**Post date:** [June 6, 2007, 11:17pm UTC](https://www.ruby-forum.com/t/login-redirect-on-ajax-call/106161/1 "2007-06-06T23:17:08Z")

</div>

Hi,

I have a link that uses the link\_to\_remote helper, however the method it  
calls requires the user to log in.

before\_filter :login\_required

How can I get the method to re-direct the user if they are not logged in  
when the Ajax call is made?

Cheers

---

<div class="post-metadata">

**Author:** ![mark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mark](https://www.ruby-forum.com/u/mark)\
**Post date:** [June 6, 2007, 11:23pm UTC](https://www.ruby-forum.com/t/login-redirect-on-ajax-call/106161/2 "2007-06-06T23:23:53Z")

</div>

If you’re doing RJS, do a page.redirect\_to(url).

Jason
