# Form\_for success and failure callbacks

**URL:** <https://www.ruby-forum.com/t/form-for-success-and-failure-callbacks/188265>\
**Category:** Rails\
**Created:** [May 8, 2010, 10:11pm UTC](https://www.ruby-forum.com/t/form-for-success-and-failure-callbacks/188265 "2010-05-08T22:11:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![philostler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dbc845/32.png) [@philostler](https://www.ruby-forum.com/u/philostler)\
**Post date:** [May 8, 2010, 10:11pm UTC](https://www.ruby-forum.com/t/form-for-success-and-failure-callbacks/188265/1 "2010-05-08T22:11:28Z")

</div>

I’ve created a login form using rails 3 & jquery-ujs and all is working  
except I’d like to detect whether the AJAX call to the server was  
successful, for example in the event that internet connection is lost.

I’m using form\_for but digging through the docs doesn’t seem to have  
anything to help with this.

My current tag looks like…  
\<%= form\_for @user\_session, :remote =\> true, :html =\> { :onsubmit =\>  
“displayProcessing()” } do |f| %\>

I’ve tried adding :success and :failure but these don’t seem to work.

Could anyone give me any pointers?

Cheers, Phil

---

<div class="post-metadata">

**Author:** ![philostler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dbc845/32.png) [@philostler](https://www.ruby-forum.com/u/philostler)\
**Post date:** [May 12, 2010, 3:31pm UTC](https://www.ruby-forum.com/t/form-for-success-and-failure-callbacks/188265/2 "2010-05-12T15:31:09Z")

</div>

Still stuck with this problem.

Does no one have any pointers on this?
